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 |
SQLBoy14
Yak Posting Veteran
70 Posts |
Posted - 2014-03-24 : 14:45:35
|
Hello, I have a column that has 50 records and they are INT. I am trying to place them into a single parameter using the CHARINDEX using the IF Statement. I got an error saying convertinh from varchar to int type data. Basically, this is what I did:@RoomID varchar(max)Then I declare it:DECLARE @RoomId varchar(4)SET @RoomID = 0The IF part that I need help to express this CHARINDEX function.Then in Where clause I filtered it as:WHERE r.roomid = @RoomIdOr what other way to handle INT data type and make them available for user to choose multiple value? SQLBoy |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-03-24 : 15:15:13
|
I must confess that I did not understand the question. How are the two - 1)"@RoomID varchar(max)" and 2) "DECLARE @RoomId varchar(4) related? Also, didn't quite get what you meant by "the IF part". If you are using a select statement, which it seems like you are based on the where clause, you cannot use IF expression in a select statement.It would be easier for someone to respond if you post examples and DDL. Some guidelines for posting are here: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|
|