1、@@ROWCOUNT可以判斷上一行查詢操作得到的列數; 2、給變量賦值用SET @Pr_id = 13; 3、察看是否有符合條件的記錄IF EXISTS (Select name FROM sysobjects Where name = 'reminder' AND type = 'TR');
說明特別是第一個,感覺在寫Proce的時候,可以好好的運用 Create Proc Add @n char(10) as Select a from Table1 where a = @n if(@@RowCount>0) Begin Update .... End Else Begin Insert .......... End