如何從sql2019儲存過程中獲取特定的字串

時間 2022-05-05 03:16:20

1樓:匿名使用者

sql也可以拆分的,

sqlserver快速查詢所有儲存過程中是否包含某字元

2樓:匿名使用者

--將text替換成你要查詢的內容

select name

from sysobjects o, syscomments swhere o.id = s.id

and text like '%text%'

and o.xtype = 'p'

--將text替換成你要查詢的內容

select routine_name, routine_definition

from information_schema.routineswhere routine_definition like '%text%'

and routine_type='procedure'

sql 怎麼擷取json字串中的特定內容

3樓:折柳成萌

**如下:

create procedure sp_str

(in p_str varchar(50), /*原始字串*/

in p_begin_str varchar(50), /*要匹配的起始字串*/

in p_end_str varchar(50)) /*要匹配的結束字串*/

out p_result varchar(50)) /*返回結果*/

not deterministic

sql security definer

comment ''

begin

declare m_len int default 0;

declare m_index int default 0;

/*計算第乙個匹配字串的索引位置*/

select locate(p_begin_str,p_str)+char_length(p_begin_str) into m_index;

/*計算第乙個匹配字串的長度*/

select locate(p_end_str,p_str,m_index) into m_len;

select substring(p_str,m_index,m_len-m_index) into p_result ;

end;

執行:call sp_str('abcd[12345]aass','abcd[',']',@result);

返回值 @result 為12345

call sp_str('abcd[sdww]aass','abcd[',']',@result);

返回值 @result 為sdww

如果不用儲存過程,可以直接寫sql語句實現:

**如下:

select substring(

']abcd[12345]111',

locate('abcd[',']abcd[12345]111')+char_length('abcd['),

locate(']',']abcd[12345]111',char_length('abcd['))-

(select locate('abcd[',']abcd[12345]111')+char_length('abcd['))

)返回值為 12345

sql server 儲存過程,怎樣把傳入的字串作為where條件

4樓:匿名使用者

需要使用動態語句

例如:declare @引數 varchar(1000)set @引數='id=1'

print 'select * from 表 where '+@引數

exec('select * from 表 where '+@引數)

5樓:匿名使用者

declare @sql nvarchar(max)

set @sql='select .... where '+@str

exec(@sql)

sqlserver快速查詢所有儲存過程中是否包含某字元

6樓:匿名使用者

右鍵單擊資料庫名--任務--生成指令碼--選擇特定資料庫物件--選擇「儲存過程」--下一步--儲存到新建查詢視窗

這樣你就得到了所有儲存過程的文字,在文字中查詢ctrl+f

7樓:匿名使用者

--將text替換成你要查詢的內容

select name

from sysobjects o, syscomments swhere o.id = s.id

and text like '%text%'

and o.xtype = 'p'

--將text替換成你要查詢的內容

select routine_name, routine_definition

from information_schema.routineswhere routine_definition like '%text%'

and routine_type='procedure'

sqlserver快速查詢所有儲存過程中是否包含某字元

8樓:day娟

-將text替換成你要查詢的內容

select name

from sysobjects o, syscomments swhere o.id = s.id

and text like '%text%'

and o.xtype = 'p'

--將text替換成你要查詢的內容

select routine_name, routine_definition

from information_schema.routineswhere routine_definition like '%text%'

and routine_type='procedure'

sqlserver快速查詢所有儲存過程中是否包含某字元

sql2019備份到sql2019不相容請幫我把這個2019的

目前只能sql2005 2008中轉一下,好像還不能直接還原到2012,兩者結構差異蠻大的。中轉下也花不了多少時間了。直接還原怕引起不必要的錯誤提示。你看可以這樣麼,在2000裡面新建乙個空的資料庫,恢復進去。然後分離,在2012裡面再附加mdf檔案。將sql2000的資料庫備份還原到sql2012...

急!!Delphi中如何連線sql2019資料庫都需要哪些控制項,屬性怎么設定

連sql2000資料庫的話可以用adoconnection adoquery adodataset和adotable這幾個元件。adoconnection雙擊元件就可以選擇資料來源 adoquery元件和query元件的使用方法類似,通過sql屬性獲取某些資料,滿足sql語句的語法格式,使用方法和a...

sql2019最大容量,SQL2000最大容量

sql2000在6萬資料時還保持在20幾m 如果你的資料庫沒有存放 等大型資料,這個是正常的問題一 基本上沒有容量極限,只要你的硬碟容量夠大問題二 將sql登入設定為僅windows即可,具體方法 右鍵伺服器名 屬性 安全性 安全性 身份驗證 僅windows w sqlserver2000技術規格...

SQL2019安裝不了,SQL2005安裝不了???

如果安裝一次失敗就的把系統重新安裝一下才能安裝,要不就安裝不上,最好安裝在系統盤裡。sql server企業版本可能無法安裝在xp上。安裝的時候最好把防火牆 防毒軟體關掉,以防認為是病毒無法載入相關的元件。sql server企業版本是不能安裝在xp上的,關了防火牆 防毒軟體關掉都沒用,去下乙個sq...

sql2019複製本地發布錯誤,sql2005複製本地發布錯誤

啟用xp cmdshell,然後執行下面的code 這是中文的翻譯 允許更改高階選項 exec sp configure show advanced options 1 go 更新當前配置的高階選項值。reconfigure go 啟用功能。exec sp configure xp cmdshell...