Ron*_*fin 6 sql-server echo notify
例如.我有一个数据库升级脚本,用于向数据库表添加列.看起来有点像这样:
IF NOT Exists(SELECT * FROM SysColumns sc, SysObjects so
WHERE sc.Name = 'dealer_number'
AND so.Name = 'collector'
AND so.Type= 'U'
AND so.id = sc.id)
BEGIN
-- SQL for creating column
END
ELSE
BEGIN
-- notify user that column already exists
END
Run Code Online (Sandbox Code Playgroud)
如何通知用户该列已存在?
RAISERROR ('column already exists',0,1) with nowait
Run Code Online (Sandbox Code Playgroud)
要么
print 'column already exists'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9809 次 |
| 最近记录: |