DEFINITIONS
Definitions More Info.
Definition ID
791
Title
SQL
Category
NOTES
Definition
Primary ya da Foreign Key leri yan yana yazdırmak
Definition Description
DECLARE @Primarykey NVARCHAR(150) = NULL ,@Primarykey2 NVARCHAR(150) = NULL ,@RowGuid NVARCHAR(50) = NULL ,@tableName NVARCHAR(100) ,@sql NVARCHAR(MAX) ,@operationValues NVARCHAR(10) SET @tableName = 'cdCurrAcc' SELECT @Primarykey = COALESCE(@Primarykey +'||','') +CAST((LTRIM(RTRIM(column_name))) AS NVARCHAR(150)) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU ON TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME AND TC.CONSTRAINT_TYPE = 'PRIMARY KEY' AND ku.table_name = @tableName ORDER BY KU.ORDINAL_POSITION ASC; PRINT(@PrimaryKey)
RecordBy
cunay
Record Date
07-09-2017 11:05:38
Düzenle
Kopyala
Sil