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 2000 Forums
 SQL Server Development (2000)
 dynamic SQL

Author  Topic 

Lady
Starting Member

32 Posts

Posted - 2002-06-11 : 03:21:21
HI!
how shell I pass unigueidentifier into stored proc as a parameter?
in sp_XXX I make a string, using @where and @guid parameters, and then exec it with 'execsql'.
How shell I set default Value?


Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-06-11 : 03:27:24
That is pretty vague.

Why don't you show us some code.

Damian
Go to Top of Page

Lady
Starting Member

32 Posts

Posted - 2002-06-11 : 03:32:43
@user_id int =0,
@searchCreteria nvarchar(4000)='p.city_id=2',
@guid uniqueidentifier = '212c8166-635c-42f3-9faf-3b4023abbe39'
as
DECLARE @keyssql AS varchar(4000)
SET @keyssql =
'select distinct
products, brands, isnull(s.subscribe_id,0) as sub, 1 as type,
........................
n.publish_date, n.exp_date

from Presentations p left outer join subscribes s
.........
left outer join dbo.NewsStatus ns on ns.news_id = n.news_id and ns.guid =' + CAST(@guid AS nvarchar(100)) +
CASE
WHEN @searchCreteria <>'' THEN ' where ' + @searchCreteria
ELSE ''
end
EXEC (@keyssql)



Go to Top of Page
   

- Advertisement -