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 |
|
PeterG
Posting Yak Master
156 Posts |
Posted - 2004-08-27 : 11:50:14
|
| declare @indexes varchar(2000)SET @indexes = '7722851,7723580,7723675'SELECT txtCostCenter, txtMerchantName, dteTransacDate, curTransacAmntFROM dbo.TransactionsWHERE lngIndex IN (@indexes)I am testing this query on SQL analyzer and it gives me error: cannot convert varchar to value int. I am passing @indexes from my asp page. How do I fix this? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-27 : 11:58:35
|
| you can't do that... use dynamic sql (bad)set @stmt = 'SELECT txtCostCenter, txtMerchantName, dteTransacDate, curTransacAmntFROM dbo.TransactionsWHERE lngIndex IN (' + @indexes + ')'or take a look at:http://www.sqlteam.com/item.asp?ItemID=11499Go with the flow & have fun! Else fight the flow :) |
 |
|
|
|
|
|