Copyright © 2008-2016 Paula DiTallo

Tag Cloud

April 2015 Entries

DB2: How do I get the Column Definitions, Column Descriptions?

These general statements will get you the information that you're looking for:SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_SIZE, COLUMN_TEXTFROM "SYSIBM"."SQLCOLUMNS"WHERE TABLE_SCHEM = 'YourSchema' AND TABLE_NAME = 'YourTableName'This will get you the definitions of the columns:SELECTt.table_schema as Library,t.table_name,t.tabl... as Length,c.numeric_precision as Precision,c.numeric_scale ......

sql server: How can I list or review the last restores for all the databases on a server?

Go to the server your are interested in gathering the information from, then issue this statement:WITH LastRestoresOnServer AS(SELECT sysdb.[name] as dbName, sysdb.[create_date], sysdb.[compatibility_level], sysdb.[collation_name], r.*, ROW_NUMBER() OVER (PARTITION BY sysDb.Name ORDER BY r.[restore_date] DESC) as RNFROM master.sys.databases sysdbLEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = sysDb.Name)SELECT *FROM [LastRestoresOnServer]WHERE RN = 1 ......

How do I Fix "Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CS_AS" and "SQL_Latin1_General_CP1_CI_AS"

You were probably trying to do a comparison between 2 databases with different collation settings on a WHERE clause or on a join. Here's how you would do the comparison with a JOIN: Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Select * from source db1.schema.table1 as t1 join source db2.schema.table2 as t2 on t1.col1 collate SQL_Latin1_General_CP1_CS_AS = t2.col1 COLLATE SQL_Latin1_General_CP1_CS_AS /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; ......