In clause  
Author Message
Keirre





PostPosted: Thu Jun 21 05:34:11 CDT 2007 Top

SQL Server Developer >> In clause

I am trying to use the in clause in the following query




From table1
Where myid=1

Select id
From table2







SQL Server267  
 
 
Uri





PostPosted: Thu Jun 21 05:34:11 CDT 2007 Top

SQL Server Developer >> In clause Hi
http://www.sommarskog.se/arrays-in-sql-2000.html







>I am trying to use the in clause in the following query
>

>

> From table1
> Where myid=1
>
> Select id
> From table2

>


> it works.
>

>
>
>


 
 
M





PostPosted: Thu Jun 21 05:41:39 CDT 2007 Top

SQL Server Developer >> In clause
> I am trying to use the in clause in the following query
>

>

> From table1
> Where myid=1
>
> Select id
> From table2

>


>


Use Dynamic SQL . I assume id is char datatype .

create table #temp (id varchar(4))
insert into #temp values ('1')
insert into #temp values ('5')









 
 
Uri





PostPosted: Thu Jun 21 06:11:26 CDT 2007 Top

SQL Server Developer >> In clause Be aware of SQL Injections

create table temp (id varchar(4))
insert into temp values ('1')
insert into temp values ('5')









select * from temp ---this table is no longer exists











>> I am trying to use the in clause in the following query
>>

>>

>> From table1
>> Where myid=1
>>
>> Select id
>> From table2

>>

>> single

>> works.
>>

>
> Use Dynamic SQL . I assume id is char datatype .
>
> create table #temp (id varchar(4))
> insert into #temp values ('1')
> insert into #temp values ('5')
>
>


>
>


>


 
 
Paul





PostPosted: Thu Jun 21 07:00:29 CDT 2007 Top

SQL Server Developer >> In clause

and pushed them into a temp table, using a while loop looking for the ",". I
then used a select subquery as the IN compare

Thanks



Be aware of SQL Injections

create table temp (id varchar(4))
insert into temp values ('1')
insert into temp values ('5')









select * from temp ---this table is no longer exists











>> I am trying to use the in clause in the following query
>>

>>

>> From table1
>> Where myid=1
>>
>> Select id
>> From table2

>>

>> single

>> works.
>>

>
> Use Dynamic SQL . I assume id is char datatype .
>
> create table #temp (id varchar(4))
> insert into #temp values ('1')
> insert into #temp values ('5')
>
>


>
>


>