当@UNo为null时,执行“select * from CustomerOrder”;
当@UNo为1时,执行“select * from CustomerOrder where U_No is null”;
当@UNo不为空也不为1时,执行“select * from CustomerOrder where U_No = @UNo”;满足上述条件的完整的存储过程该怎么写?求教!
当@UNo为1时,执行“select * from CustomerOrder where U_No is null”;
当@UNo不为空也不为1时,执行“select * from CustomerOrder where U_No = @UNo”;满足上述条件的完整的存储过程该怎么写?求教!
解决方案 »
- 服务器开启系统防火墙,添加1433例外,内网无法做数据交流,外网却可以。
- 寻找最佳的SQL语句!
- 如何在2005里面取的某个表的里面所有字段的名字,类型,长度等信息啊?
- 非常妖的问题,sql放在存储过程是错的,放在查询分器里是正确的
- sql server默认值问题,如何将c列的默认值设置成a列乘以b列
- 50分求此问题,在表A上建了一添加记录时的触发器,怎么取到所添加的记录某一字段的值。谢谢!
- 请教一个导入时更改数据的问题?
- 大师们,在公司考了个mdf,日志文件太大,sql 2005怎么只附加mdf呢,求救
- MSDE怎么用VB程序设置其连接超时为0
- 将当前有效期下同类的最小有效日期选出来。【好似很拗口,可以进去指教】
- 定时作业,无法读取链接服务器的表
- 用log explorer 恢复删除的数据表,提示 getrow() NUll
(
@UNo INT NULL
)
AS
BEGIN
IF @UNo IS NULL
select * from CustomerOrder
ELSE IF @UNo = 1
select * from CustomerOrder where U_No is null
ELSE
select * from CustomerOrder where U_No = @UNo
END
begin
select * from CustomerOrder
endelse
begin
if isnull(@UNo,'')= '1'
begin
select * from CustomerOrder where U_No is null
end
else
begin
select * from CustomerOrder where U_No = @UNo
end
end