时间:2021-07-01 10:21:17 帮助过:3人阅读
declare @errorMsg nvarchar(500); declare @tmpErrorMsg nvarchar(500); declare @pkCount int; declare @PKTable table (TABLE_QUALIFIER varchar(100), TABLE_OWNER varchar(100), TABLE_NAME varchar(100), COLUMN_NAME varchar(100), KEY_SEQ int, PK_NAME varchar(100)); --在有字符串拼接的情況下,必須要初始化字符串 set @errorMsg = N‘‘; insert into @PKTable EXEC sp_pkeys @table_name=‘role‘; set @pkCount=(select COUNT(*) from @PKTable); if(@pkCount <= 0) begin set @errorMsg += N‘表 role 沒有主鍵‘+‘.‘; end delete from @PKTable;
sql server字符串相加为NULL
标签: