SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


parameter in dataset


parameter in dataset

Author
Message
Keywest
Keywest
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 21
I am creating a parameter with the default value as test
in the dataset i need to use it in the query for the schema name. how do i do it

select * from (Parameters!param0.value).tablename;


i am getting an error missing right parenthesis. NOt sure how to do it? any suggestion
Snigdha Vartak
Snigdha Vartak
Say Hey Kid
Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)Say Hey Kid (692 reputation)

Group: General Forum Members
Points: 692 Visits: 247
You may use dynamic SQL statements. something like,

--@schema is parameter
Declare @val1 nvarchar(500)

SET @val1 ='Select * from ' + @schema+'.'+'TableName'
execute(@val1)
Amit Raut
Amit Raut
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1217 Visits: 342
Snigdha Vartak (8/17/2013)
You may use dynamic SQL statements. something like,

--@schema is parameter
Declare @val1 nvarchar(500)

SET @val1 ='Select * from ' + @schema+'.'+'TableName'
execute(@val1)


In similar case, Dynamic SQL worked for me.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search