Showing posts with label fails. Show all posts
Showing posts with label fails. Show all posts

Monday, March 26, 2012

Row_Number() fails to return anything

I am using SQLExpress and want to do some custom paging with a grid but can not get the sproc to produce any results. I don't get any error just a resultset of 0 rows whenever I include the row_number function.

Sample Table:
refID int identity increments by 1
refSubject nvarchar(100)
refBody nText

Sample sproc that works
create proc sp_RefListing as
select refid
, refsubject
from myTable

Sample Sproc that doesn't work:
with OrderedRefList as
(Select refid
,refsubject
,row_number() OVER (order by refsubject) as rownum
from myTable)
select refid
,refsubject
,rownum
from OrderedRefList
where rownum < 10

When I execute I get no errors or warnings during save, but I get no data.

Is there something I am doing wrong, is there a setting in SQLExpress I need to change to allow row_number?

Thanks in advance for your assistance,

Al


Did you ever get an answer to this question? I am having the same issue. The SPROC doesn't return anything when executed within Visual Studio 2005 Pro, but will return fine if the same query is put into a view, or if the SPROC is called from MS Access or SQL Management Studio. Appears to be a problem with Visual Studio 2005.sql

Row_Number() fails to return anything

I am using SQLExpress and want to do some custom paging with a grid but can not get the sproc to produce any results. I don't get any error just a resultset of 0 rows whenever I include the row_number function.

Sample Table:
refID int identity increments by 1
refSubject nvarchar(100)
refBody nText

Sample sproc that works
create proc sp_RefListing as
select refid
, refsubject
from myTable

Sample Sproc that doesn't work:
with OrderedRefList as
(Select refid
,refsubject
,row_number() OVER (order by refsubject) as rownum
from myTable)
select refid
,refsubject
,rownum
from OrderedRefList
where rownum < 10

When I execute I get no errors or warnings during save, but I get no data.

Is there something I am doing wrong, is there a setting in SQLExpress I need to change to allow row_number?

Thanks in advance for your assistance,

Al


Did you ever get an answer to this question? I am having the same issue. The SPROC doesn't return anything when executed within Visual Studio 2005 Pro, but will return fine if the same query is put into a view, or if the SPROC is called from MS Access or SQL Management Studio. Appears to be a problem with Visual Studio 2005.

Monday, March 12, 2012

Row Count validation fails

I setup transactional replication with automatic updates.
In doing this I did a manual initialization of the schema
by doing a dump and restore of the publisher. When i
validate my subscription i have many tables that dont
pass the rowcount. I think it may be that between my
restore and initilizing the subscription that data may
have chnaged on the publisher? Is there a way to manually
synch up all my tables?
Tim,
there's no way to do this automatically. Manually, you can do a binary
rowcount to determine the non-matching rows, modify them using linked
servers then do your nosyny initialization. This has to be done out-of-hours
to avoid the problem you have already seen.
Allowing the initialization to be produced via the snapshot doesn't have
this problem, as you have the choice of a shared lock on the publisher's
table or a concurrent snapshot, where the data modifications are themselves
logged and passed on to the subscriber.
HTH,
Paul Ibison
|||Sorry - should have said BINARY_CHECKSUM() not rowcount.
Regards,
Paul Ibison