當前位置:首頁 » 編程語言 » sql數組欄位

sql數組欄位

發布時間: 2024-06-09 01:48:50

㈠ 如何數組欄位裡面進行查詢,sql語句該怎麼樣寫

數組形式? 難道是 欄位 a "1,2,3,4,5,6,7,8,9,10,13" 如果是這樣 select * from table where ','+a like '%,7,%'

㈡ 一個數組如何存入到sql資料庫中某個欄位中

存可以把數組連成字元串的形式存 取得時候再分割就好了
比如5個數字
update 表 set unum="1,2,3,4,5"
取出來以後用split()函數分割 就好了

㈢ sql存儲過程處理數組參數

declare@strvarchar(500)
declare@insertvarchar(8000)
select@insert='insertintoyouTablevalues'
select@str='str1,1,1,1,1|str2,2,2,2,2|str3,3,3,3,5|str4,4,4,45,4'
select@str=@insert+'('''+@str+''')'
select@str=REPLACE(@str,',',''',''')
select@str=REPLACE(@str,'|',''')'+CHAR(13)+@insert+'(''')
print@str
--exec(@str)動態執行下生成的語句就好了

--print結果如下:
insertintoyouTablevalues('str1','1','1','1','1')
insertintoyouTablevalues('str2','2','2','2','2')
insertintoyouTablevalues('str3','3','3','3','5')
insertintoyouTablevalues('str4','4','4','45','4')

熱點內容
超級訪問羅大佑 發布:2025-07-11 07:43:33 瀏覽:387
邁騰有什麼安全配置 發布:2025-07-11 07:42:40 瀏覽:644
c語言字元逆序 發布:2025-07-11 07:41:57 瀏覽:923
怎麼配置交換機的console密碼 發布:2025-07-11 07:41:57 瀏覽:4
東芝存儲卡視頻 發布:2025-07-11 07:41:55 瀏覽:541
cs16為什麼搜不到區域網伺服器 發布:2025-07-11 07:41:21 瀏覽:913
php項目如何上傳伺服器 發布:2025-07-11 07:35:35 瀏覽:182
壓縮機4井 發布:2025-07-11 07:34:57 瀏覽:726
win7訪問共享 發布:2025-07-11 07:34:48 瀏覽:279
telnetlinux退出 發布:2025-07-11 07:29:46 瀏覽:791