August 21, 2002 at 11:50 am
I am trying to execute a query to return the list of user tables without column header, row count or misc. spaces. Just the table names separated by cr/lf. I've tried osql,isqlw using: select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE'. set NOCOUNT eliminates the row count and I can eliminate the header using the option -h-1 (osql) but how about the spaces? Thanks in advance.
August 21, 2002 at 12:34 pm
I'm guessing you mean the trailing spaces behind the table names. If so would something like this work for you:
declare x cursor for
select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE'
open X
declare @t char(128)
fetch next from X into @T
WHILE @@FETCH_STATUS = 0
BEGIN
print rtrim(@T)
fetch next from x into @t
end
close x
deallocate x
-------------------------
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
August 22, 2002 at 11:54 am
this is exactly what I was looking for. thanks again.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply