當前位置:首頁 » 編程語言 » 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;

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:710
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:972
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:681
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:834
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:741
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1081
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:313
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:192
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:880
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:837