I'm a newbee to this forum. I've a question, is there any limitation
on "IN" clause in select query.
for example :
"SELECT EMP_ID, EMP_NAME FROM EMPLOYEE WHERE EMP_ID IN
('EMP1001','EMP1002','EMP1003', etc, etc, so on)".
I've read at some documentation that there is a limitation for Columns
in a table and i.e. we can have only 1024 columns per table, is this
true?
Plz help me !!
Thanx in advance.
Kind Regards,
HarryOn 2 Aug 2006 05:31:03 -0700, harsha.21aug@.gmail.com wrote:
Quote:
Originally Posted by
>Hi all there,
I'm a newbee to this forum. I've a question, is there any limitation
>on "IN" clause in select query.
>for example :
>"SELECT EMP_ID, EMP_NAME FROM EMPLOYEE WHERE EMP_ID IN
>('EMP1001','EMP1002','EMP1003', etc, etc, so on)".
There doesn't seem to be a documented limit, but if the list gets too
long it should be in a table, not in-line code.
Quote:
Originally Posted by
>I've read at some documentation that there is a limitation for Columns
>in a table and i.e. we can have only 1024 columns per table, is this
>true?
Yes, the limit is 1024 columns in a table. Any database design that
comes close to this, much less needs to exceed it, is probably
questionable.
Quote:
Originally Posted by
>Plz help me !!
>
>Thanx in advance.
>
>Kind Regards,
>Harry
Roy Harvey
Beacon Falls, CT|||Thanx alot Roy. :)
Roy Harvey wrote:
Quote:
Originally Posted by
On 2 Aug 2006 05:31:03 -0700, harsha.21aug@.gmail.com wrote:
>
Quote:
Originally Posted by
Hi all there,
I'm a newbee to this forum. I've a question, is there any limitation
on "IN" clause in select query.
for example :
"SELECT EMP_ID, EMP_NAME FROM EMPLOYEE WHERE EMP_ID IN
('EMP1001','EMP1002','EMP1003', etc, etc, so on)".
>
There doesn't seem to be a documented limit, but if the list gets too
long it should be in a table, not in-line code.
>
Quote:
Originally Posted by
I've read at some documentation that there is a limitation for Columns
in a table and i.e. we can have only 1024 columns per table, is this
true?
>
Yes, the limit is 1024 columns in a table. Any database design that
comes close to this, much less needs to exceed it, is probably
questionable.
>
Quote:
Originally Posted by
Plz help me !!
Thanx in advance.
Kind Regards,
Harry
>
Roy Harvey
Beacon Falls, CT|||Harsha, See this post
http://groups.google.com/group/comp...2da17b97723fe15
harsha.21aug@.gmail.com wrote:
Quote:
Originally Posted by
Thanx alot Roy. :)
>
Roy Harvey wrote:
Quote:
Originally Posted by
On 2 Aug 2006 05:31:03 -0700, harsha.21aug@.gmail.com wrote:
Quote:
Originally Posted by
>Hi all there,
I'm a newbee to this forum. I've a question, is there any limitation
>on "IN" clause in select query.
>for example :
>"SELECT EMP_ID, EMP_NAME FROM EMPLOYEE WHERE EMP_ID IN
>('EMP1001','EMP1002','EMP1003', etc, etc, so on)".
There doesn't seem to be a documented limit, but if the list gets too
long it should be in a table, not in-line code.
Quote:
Originally Posted by
>I've read at some documentation that there is a limitation for Columns
>in a table and i.e. we can have only 1024 columns per table, is this
>true?
Yes, the limit is 1024 columns in a table. Any database design that
comes close to this, much less needs to exceed it, is probably
questionable.
Quote:
Originally Posted by
>Plz help me !!
>
>Thanx in advance.
>
>Kind Regards,
>Harry
Roy Harvey
Beacon Falls, CT|||(harsha.21aug@.gmail.com) writes:
Quote:
Originally Posted by
I'm a newbee to this forum. I've a question, is there any limitation
on "IN" clause in select query.
for example :
"SELECT EMP_ID, EMP_NAME FROM EMPLOYEE WHERE EMP_ID IN
('EMP1001','EMP1002','EMP1003', etc, etc, so on)".
To add to Roy's response, be aware of that when the list grows very
long (1000 elements) compile times on SQL 2000 can be absymal. SQL 2005
appears to do better in this regard.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
No comments:
Post a Comment