Of course if you’re lazy like me, you could just do this:
Declare @Ids varchar(50) Set @Ids=",1,2,3,5,4,6,7,98,234,"
Select * from sometable
where Charindex(','+cast(tableid as varchar(8000))+',', @Ids) > 0
More Related Contents:
- I dont know sql syntax for my table [closed]
- Get top 1 row of each group
- How to return only the Date from a SQL Server DateTime datatype
- DateTime2 vs DateTime in SQL Server
- How to select all records from one table that do not exist in another table?
- SET versus SELECT when assigning variables?
- How do you list the primary key of a SQL Server table?
- Generate Dates between date ranges
- Calculating distance between two points (Latitude, Longitude)
- Add Foreign Key relationship between two Databases
- How to print VARCHAR(MAX) using Print Statement?
- How to assign an exec result to a sql variable?
- Query error with ambiguous column name in SQL
- Why (and how) to split column using master..spt_values?
- Splitting delimited values in a SQL column into multiple rows
- What does =* mean?
- SQL: parse the first, middle and last name from a fullname field
- varbinary to string on SQL Server
- Scope of temporary tables in SQL Server
- How can I include null values in a MIN or MAX?
- SQL Server 2005 ROW_NUMBER() without ORDER BY
- Can an INNER JOIN offer better performance than EXISTS
- Find the real column name of an alias used in a view?
- Stored procedure that exports data into csv files only exports to one file
- Get Start and End Date from Week Number SQL Server
- Get the last day of the month in SQL
- How to create a pivot query in sql server without aggregate function
- SQL take just the numeric values from a varchar
- COALESCE Function in TSQL
- Convert bigint to datetime