create proc sp_get_coll
as
/*
declare @temp TABLE (
col1 VARCHAR(32),
col2 VARCHAR(32),
col3 VARCHAR(32),
col4 VARCHAR(32),
col5 VARCHAR(32)
)
insert @temp */
SELECT
CONVERT(varchar(50), obj.name) as tablo,
CONVERT(varchar(50), col.name) as kolon,
spt_dtp.LOCAL_TYPE_NAME as veritipi,
CONVERT(int, spt_dtp.charbin +
CASE WHEN spt_dtp.LOCAL_TYPE_NAME IN ('nchar', 'nvarchar', 'ntext')
THEN 2 * OdbcPrec(col.xtype, col.length, col.xprec)
ELSE
OdbcPrec(col.xtype, col.length, col.xprec) END) as boyut
, col.collation as coll FROM
sysobjects obj,
master.dbo.spt_datatype_info spt_dtp,
systypes typ,
syscolumns col LEFT OUTER JOIN
syscomments com ON col.cdefault = com.id AND com.colid = 1,
master.dbo.syscharsets a_cha
WHERE
permissions(obj.id, col.name) != 0
AND obj.id = col.id
AND typ.xtype = spt_dtp.ss_dtype
AND (spt_dtp.ODBCVer IS NULL OR spt_dtp.ODBCVer = 2)
AND obj.xtype IN ('U', 'V')
AND col.xusertype = typ.xusertype
AND col.collation IS NOT NULL
AND (spt_dtp.AUTO_INCREMENT IS NULL OR spt_dtp.AUTO_INCREMENT = 0)
AND a_cha.id = isnull(CONVERT(tinyint, CollationPropertyFromID(col.collationid, 'sqlcharset')),
CONVERT(tinyint, ServerProperty('sqlcharset')))
/*
select ( 'alter table '+col1+ ' alter column '+col2+' '
+col3+'('+col4+') collate '+col5 ) from @temp
*/
go
bunu
şeklinde çalıştır.
bu dbde tabloda bulunan string tipindeki verilerin db de hangi dil karakter seti vs.. ile tutulduğunu gösterir
N/A
|