[dba-SQLServer] strip all leading / trailing spaces

artful at rogers.com artful at rogers.com
Thu Dec 7 12:25:12 CST 2006


JC, you should now be able to combine this with the other code I showed you, to generate the UPDATE statements you'll need. If you need any more assistance, shout.

I was going to do this, but it appears that on my three boxes, I'm running only SQL 2005.  I think I'll do something about that. I still have an ancient server -- oh wait, it IS running 2000. When I get a moment I'll combine the two snippets into something that does it all for 2000 as well as 2005.

Arthur

----- Original Message ----
From: David Lewis <DavidL at sierranevada.com>
To: dba-sqlserver at databaseadvisors.com
Sent: Thursday, December 7, 2006 1:03:56 PM
Subject: [dba-SQLServer] strip all leading / trailing spaces




For sql2K, your query might looks something like:

SELECT o.name Table_Name
    , c.name Column_Name
    , t.name DataType
    , c.Length
    , CASE WHEN c.isnullable=1 THEN   'Yes'       
        ELSE   'No'   END 
    AS 'Nullable' 
FROM sysobjects o
INNER JOIN syscolumns c ON (o.id=c.id and o.type='U')
INNER JOIN systypes t ON (c.xtype=t.xtype) 
ORDER BY o.name, c.name


This will give a list of all user tables in the db, with all columns,
datatypes, lengths, and if nullable.  

In the master database there are many stored procedures that can also
help you.  For this particular problem sp_MSHelpColumns is likely the
place to start (and isn't much different from the query above).  HTH.
D. Lewis
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com








More information about the dba-SQLServer mailing list