![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 瞌男 ![]()
![]() |
SQL欄位格式uniqueidentifier 16進位的資料 該如何讀取及存入呢?
搜尋相關Tags的文章:
[ uniqueidentifier ] ,
本篇文章發表於2020-12-25 11:17 |
1樓 |
![]()
本篇文章回覆於2020-12-25 13:58
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
2樓
作者回應
瞌男 ![]() |
感謝 #真的有點難
那是不是就跟給這筆資料一個編碼是嗎? 不解為何要用 uniqueidentifier 型態 可否舉例我用 uniqueidentifier 型態的時機呢?
本篇文章回覆於2020-12-25 15:07
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
3樓 |
希望對您有幫助
當SQL Server 200x 新的 uniqueidentifier資料型態,遇見 SqlDataSource https://dotblogs.com.tw/mis2000lab/2010/11/03/uniqueidentifier_sqldatasource 遇見錯誤 -- 「不允許從資料類型 sql_variant 隱含轉換到 uniqueidentifier。請使用 CONVERT 函數來執行查詢。 」 您必須自己動手,修改 SQL指令 InsertCommand="INSERT INTO [News_test] ([test_uid], [test_time]) VALUES (NewID() , @test_time)" SelectCommand="SELECT test_id, cast([test_uid] as varchar(36)) as test_uid, [test_time] FROM [News_test]" UpdateCommand="UPDATE [News_test] SET [test_uid] = cast(@test_uid as varchar(36)), [test_time] = @test_time WHERE [test_id] = @test_id"
本篇文章回覆於2020-12-25 20:03
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
4樓 |
多台 Server 有匯集資料到資料中心需求時,使用 uniqueidentifier 可以避免處理 Primary Key 問題
這個連結討論也參考看看 https://ithelp.ithome.com.tw/questions/10143595
本篇文章回覆於2020-12-28 09:56
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
5樓
作者回應
瞌男 ![]() |
pilipala 及樓上幾位解答
那在請教一下 uniqueidentifier 屬性欄位值是會自動產生還是一定要NewID()產生?
本篇文章回覆於2020-12-28 10:30
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
6樓 |
可以設定欄位預設值來做到所謂的自動產生,但是預設值也是透過 newid() 產生的
本篇文章回覆於2021-01-05 09:51
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
回覆 |
如要回應,請先登入. |