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 |
|
Thiyagu_04
Starting Member
37 Posts |
Posted - 2008-07-22 : 08:17:46
|
| declare @ID intexec('SELECT * from tablen where id='+cast(@id as varchar(100))) |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-22 : 08:19:53
|
declare @ID intdeclare @sql varchar(1000)set @sql = 'SELECT * from tablen where id = ' + cast(@id as varchar(100))exec(@sql) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-22 : 08:20:25
|
[code]declare @ID int, @sql nvarchar(4000)select @sql = 'SELECT * from tablen where id='+cast(@id as varchar(100))exec(@sql)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-22 : 08:21:27
|
 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Thiyagu_04
Starting Member
37 Posts |
Posted - 2008-07-22 : 08:22:30
|
| Thanks for the helpMay i know why cast giving problem inside Exec() |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-22 : 08:26:11
|
Books Online says it has to be a command stringms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/bc806b71-cc55-470a-913e-c5f761d5c4b7.htm E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|