sql中应注意的问题
1。判断null 应该使用 columnName is null ColumnName is not null
2跨库查询。
a.首先Server1建立LinkServer
b.SQL: select top 10 * from Server2.DB2.dbo.Table2 a , DB1.dbo.Table1 b where a.ID = b.ID
c.在Server1上执行上面SQL.
3.对数据库进行update,insert,delete 一定要注意备份数据库,血的教训呀
4.问题:"A severe error occurred on the current command. The results, if any, should be discarded. "
解决:Have a web C# dot net application executing stored procedures using the Microsoft SQLHelper.cs class.
We are experiencing severe errors and network errors when trying to execute stored procedures that take NVarChar parameters on SQL servers with service pack 3a (8.00.818) installed. Prior versions of SQL ie: service pack 3 and less, it works perfectly fine.
On stepping through the Microsoft SQLHelper class, we noticed that the SQLCommand parameters object Size setting for NVarChar fields is set automatically to 8000.
If one changes the code and manually set the Size property to 4000, then it works for service pack 3a.