看板 Database 關於我們 聯絡資訊
※ 引述《sattn (阿猴)》之銘言: : 我有一個表格欄位m_num,型態為varchar(10) : 格式:M_00000001 : 需要在新增會員時讓他自動+1要怎麼寫呢? : 我的想法是 : select 'M_' + str(max(m_num)+10,8,0) from member; select 'M_' + str(max(cast(substring(m_num,1,2) as int))+10,8,0) from member; : 但會出現錯誤 : 將 varchar 數值 'M_00000009' 轉換成資料型別為 int 的資料行語法錯誤。 : 請問我該怎麼做? : 謝謝各位! -- 沒有 sql server 可以試,不知道有沒有打錯 -- ▃▅▇▆▄ ▆▂▃ ` 逝去感如何能留住,半點遺留殊不易,██▅▇▄▃ ▇▃▂" . █████████▃i ▁▄▇ 更多悽悽慘慘的遭遇………██▆▃ █▅▆▃ˍ▄* ▂█▄▇▅▂. 我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.184.116.195