sql語句中字符型和數值型互轉後運算問題

兩種互轉後運算有些麻煩,因數據庫類型不一樣,使用的函數也不一樣,先說數值型轉字符型運算


access中可以這樣用:
select id,(username+cstr(id) ) as userxx from .....

mssql中可以這樣用:
select id,(username+convert(nvarchar(20),id) ) as userxx from .....


再說字符型轉數值型運算


access中可以這樣用:
select id,( val(id)*3 ) as id3 from .....

mssql中可以這樣用:
select id,( convert(int,id) * 3 ) as id3 from .....
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章