|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
EXCEL不知道怎么操作
[code=sql]USE tempdb
IF OBJECT_ID('test')IS NOT NULL
DROP TABLE test;
GO
CREATE TABLE test
(
id int,name char(1)
);
GO
INSERT INTO test VALUES
(1,'a'),
(2,'b');
GO
-------------------------------------
declare @id int,@name char(1)
select @id='',@name=''
if @id='' and @name=''
select * from test
else if @id<>'' and @name=''
select * from test where id=@id
else if @id='' and @name<>''
select * from test where name=@name
else
select * from test where id=@id and name=@name[/code] |
|