當前位置:首頁 » 編程語言 » sqlserver通配符

sqlserver通配符

發布時間: 2025-09-08 10:41:59

sql中,LIKE 的 用法

SQL Server里有[^]。
樓主要的查詢是
select * from A where 姓名欄位 not like '[^王]%'

是就是非的非。

Ⅱ sqlserver怎麼創建存儲過程

SQL創建存儲過程的基礎語法是:

create proc | procere pro_name

[{@參數數據類型}=[默認值][output], {@參數數據類型}=[默認值][output], .... ]

as

SQL_statements

常見的創建存儲過程實例如下:

1、創建不帶參數的存儲過程:

create proc proc_get_student

as

select*from student;

執行存儲過程:

exec proc_get_student;

2、帶參數的存儲過程:

create proc proc_find_stu(@startId int, @endId int)

as

select*from student where id between @startId and @endId;

執行存儲過程:

exec proc_find_stu 2, 4;

3、帶通配符參數的存儲過程:

create proc proc_findStudentByName(@name varchar(20)='%j%', @nextName varchar(20)='%')

as

select*from student where name like @name and name like @nextName;

執行存儲過程:

exec proc_findStudentByName;

exec proc_findStudentByName '%o%', 't%';

4、帶輸出參數的存儲過程:

create proc proc_getStudentRecord( @id int, -- 默認輸入參數

@name varchar(20) out, -- 輸出參數

@age varchar(20) output -- 輸入輸出參數 )

as

select @name = name, @age = age from student where id = @id and sex = @age;

執行存儲過程:

declare @id int, @name varchar(20), @temp varchar(20);

set @id = 7;

set @temp = 1;

exec proc_getStudentRecord @id, @name out, @temp output;

select @name, @temp;

print @name + '#' + @temp;

熱點內容
安卓如何連接倍思 發布:2025-09-08 15:14:14 瀏覽:551
天刀起號腳本 發布:2025-09-08 15:08:47 瀏覽:596
存儲過程日期參數 發布:2025-09-08 14:33:46 瀏覽:831
核桃編程庫 發布:2025-09-08 14:25:30 瀏覽:120
明日之後怎麼同伺服器 發布:2025-09-08 14:05:50 瀏覽:80
安卓手機怎麼定位置 發布:2025-09-08 13:45:01 瀏覽:386
如何找到伺服器數據 發布:2025-09-08 13:37:05 瀏覽:633
編程值得學嗎 發布:2025-09-08 13:35:44 瀏覽:870
db2資料庫控制中心 發布:2025-09-08 13:29:18 瀏覽:906
半導體存儲晶元的驛碼驅動方式 發布:2025-09-08 12:43:06 瀏覽:629