Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


List all tables without LOB columns


List all tables without LOB columns

Author
Message
SQLSACT
SQLSACT
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1588 Visits: 2931
Comments posted to this topic are about the item List all tables without LOB columns
Coozie
Coozie
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 Visits: 354
Could you expand on the benefit of this in relation to online indexing?

Thanks,
Mark
SQLSACT
SQLSACT
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1588 Visits: 2931
A Clustered Index whose base table that has any column that is LOB cannot be rebuilt online.

A Non clustered index whose base table has any non key LOB columns participating in the index cannot be rebuilt online.
jeremy.singer
jeremy.singer
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 7
You could do this query without resorting to using sysobjects and sysindexes (use information_schema)

For example:

select table_name
from information_schema.tables
where table_name not in (select distinct table_name
from information_schema.columns
where data_type in('text','ntext','image')
or (data_type in('char','nchar','varchar','nvarchar')
and character_maximum_length=-1)
)
SQLSACT
SQLSACT
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1588 Visits: 2931
Without the ('char','nchar','varchar','nvarchar') though
Those arent LOB columns
Coozie
Coozie
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 Visits: 354
Thank you very much.

-Mark
jeremy.singer
jeremy.singer
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 7
You are right.
I was following the original poster's code in functionality, looking for char fields of maximum size.
aqeelahmed
aqeelahmed
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 13
More simplified form:-)

SELECT '['+SCHEMA_NAME(SCHEMA_ID)+'].['+name+']' TableName
FROM Sys.tables WHERE name NOT IN (
SELECT Distinct ic.TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS ic
INNER JOIN Sys.tables st ON ic.TABLE_NAME=st.name
WHERE ic.DATA_TYPE IN('text', 'ntext', 'image')
OR CHARACTER_MAXIMUM_LENGTH = '-1')
aqeelahmed
aqeelahmed
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 13
Most simplified form :-)

SELECT '['+SCHEMA_NAME(SCHEMA_ID)+'].['+name+']' TableName
FROM Sys.tables WHERE name NOT IN (
SELECT Distinct ic.TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS ic
WHERE ic.DATA_TYPE IN('text', 'ntext', 'image')
OR CHARACTER_MAXIMUM_LENGTH = '-1')

Aqeel Ahmed
Iwas Bornready
Iwas Bornready
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10058 Visits: 885
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search