Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 StoredProcedure

Author  Topic 

oguzkaygun
Yak Posting Veteran

53 Posts

Posted - 2009-02-25 : 11:11:45
hi

i have below stored procedure.. it works truely.. but my tableadapter of my dataset1.xsd cant accept it... it give me error that Listurunlistesi cant be found.. how can i fix it ? can u design my storedprocedure ? what should i do ?

Also i see only UserId at gridview1 from first Select query.. but i should see amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi at gridview1 from Second Select query

how can i do this ?

thanks

ALTER PROCEDURE dbo.magazalarliste
@aktifmagaza varchar(5),

@ilanturu varchar(18),
@aktifilan varchar(5),

@kategori varchar(23),
@kategori1 varchar(48),

@kategori2 varchar(55), @StartRowIndex INT,
@NumRows INT

*/

AS

begin

;WITH Listurunlistesi AS (

SELECT ROW_NUMBER() OVER (order by UserId desc)

AS Row, UserId

FROM urunlistesi

where ilanturu = @ilanturu

and aktifilan = @aktifilan

and kategori = @kategori

and ((@kategori1 is null) or (kategori1 = @kategori1))

and ((@kategori2 is null) or (kategori2 = @kategori2))

group by UserId
)

SELECT *

FROM Listurunlistesi

WHERE Row between @StartRowIndex and @StartRowIndex+@NumRows

END

BEGIN

;WITH ListEntries AS (

SELECT ROW_NUMBER() OVER (ORDER BY amagazalar.[onsira], amagazalar.[magazanumarasi] desc)

AS Row, amagazalar.magazanumarasi, amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi

FROM amagazalar

inner join Listurunlistesi on amagazalar.UserId = Listurunlistesi.UserId

where aktifmagaza = @aktifmagaza
)

SELECT amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi

FROM ListEntries

WHERE Row between @StartRowIndex and @StartRowIndex+@NumRows

END



RETURN

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-25 : 12:07:43
quote:
Originally posted by oguzkaygun

hi

i have below stored procedure.. it works truely.. but my tableadapter of my dataset1.xsd cant accept it... it give me error that Listurunlistesi cant be found.. how can i fix it ? can u design my storedprocedure ? what should i do ?

Also i see only UserId at gridview1 from first Select query.. but i should see amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi at gridview1 from Second Select query

how can i do this ?

thanks

ALTER PROCEDURE dbo.magazalarliste
@aktifmagaza varchar(5),

@ilanturu varchar(18),
@aktifilan varchar(5),

@kategori varchar(23),
@kategori1 varchar(48),

@kategori2 varchar(55), @StartRowIndex INT,
@NumRows INT

*/

AS

begin

;WITH Listurunlistesi AS (

SELECT ROW_NUMBER() OVER (order by UserId desc)

AS Row, UserId

FROM urunlistesi

where ilanturu = @ilanturu

and aktifilan = @aktifilan

and kategori = @kategori

and ((@kategori1 is null) or (kategori1 = @kategori1))

and ((@kategori2 is null) or (kategori2 = @kategori2))

group by UserId
)

SELECT *

FROM Listurunlistesi

WHERE Row between @StartRowIndex and @StartRowIndex+@NumRows

END

BEGIN


,WITH ListEntries AS (

SELECT ROW_NUMBER() OVER (ORDER BY amagazalar.[onsira], amagazalar.[magazanumarasi] desc)

AS Row, amagazalar.magazanumarasi, amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi

FROM amagazalar

inner join Listurunlistesi on amagazalar.UserId = Listurunlistesi.UserId

where aktifmagaza = @aktifmagaza
)

SELECT amagazalar.UserId, amagazalar.madi, amagazalar.maciklama, amagazalar.resim1, amagazalar.urunsayisi

FROM ListEntries

WHERE Row between @StartRowIndex and @StartRowIndex+@NumRows

END



RETURN



you need to remove intermeediate select as cte will be avialble only for first select statement after definition
Go to Top of Page

oguzkaygun
Yak Posting Veteran

53 Posts

Posted - 2009-02-25 : 14:12:57
hi
when i remove ur red lines, i have error message that incorrect syntax near ';'
what should i do ?
Go to Top of Page
   

- Advertisement -