判断某字段不存在然后insert添加一条 怎样用一条sql语句并返回 成功,或者失败 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if exists (select 1 from syscolumns where id=object_id('表名') and name=@name) pring '成功'else pring '失败' if not exists(select 1 from tb where id=100) insert into tb select 100,'aa','bb' --如果同时还要返回信息,那要用存储过程 declare @name varchar(100) --字段名if exists (select 1 from syscolumns where id=object_id('表名') and name=@name) print '成功'else print '失败' --不过,如果这也能算是一条语句的话...if not exists(select 1 from tb where id=100) begin insert into tb select 100,'aa','bb' select '成功' end else select '失败' ACCESS和MSSQL差不多,你可以试试. 不行,期待delete 。。等 语句然后选定的是if 只有高手才能弄出来的SQL 跪求!! 关于触发器中遇到需要删除外键约束的问题~~ 邹老大书上一个问题不懂 大家帮帮忙~~~ 不重复排列组合的程序 关于SQLSERVER2000 占用机器内存如何释放的问题 求教一条sql语句 一个存储过程,如何查询另外一个数据库里的表? 为什么要用SQL SERVER?为什么不选择ACCESS?请有经验的朋友谈. 很着急的数据库原理问题! 如何判断是否启动了SQL Server服务管理器中的Distributed Transaction Coordinator服务. 执行存储过程后,怎么再执行自定义函数 新手 求一条sql 语句 谢谢
pring '成功'
else
pring '失败'
--如果同时还要返回信息,那要用存储过程
if exists (select 1 from syscolumns where id=object_id('表名') and name=@name)
print '成功'
else
print '失败'
--不过,如果这也能算是一条语句的话...
if not exists(select 1 from tb where id=100) begin insert into tb select 100,'aa','bb' select '成功' end else select '失败'