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.
| Author |
Topic |
|
tech1
Starting Member
49 Posts |
Posted - 2012-03-27 : 04:47:50
|
| if I have a sproc which has an OUTPUT param:@myParam BITand I execute a query I create within the SPROC and use SP_EXECUTESQL to execute that query, how can I, within that string query, set @myParam value?is it possible? |
|
|
rajarajan
Starting Member
48 Posts |
Posted - 2012-03-27 : 04:57:11
|
| DECLARE @SQLString nvarchar(500);DECLARE @ParmDefinition nvarchar(500);DECLARE @CountSQLQuery varchar(30);SET @SQLString = N'SELECT @result = COUNT(*) FROM Tabel ';SET @ParmDefinition = N'@result varchar(30) OUTPUT';EXECUTE sp_executesql @SQLString, @ParmDefinition, @result=@CountSQLQuery OUTPUT;-- print @CountSQLQuerySELECT CAST(@CountSQLQuery as int); |
 |
|
|
|
|
|