SqlServer 常用語句,sqlserver語句

來源:互聯網
上載者:User

SqlServer 常用語句,sqlserver語句


select * into A   --自動產生表A,表A的結構資料和表B一樣
from B 


insert into A   --A要提前建立
select * from B


insert into A(欄位1,欄位2,...)

values

(值1,值2,...)


insert into A

values

(值1,值2,...)


insert into A(欄位1,欄位2,...)

select 欄位a,欄位b,... from B



正確更新:

update ut_syhh_折算率調整_總賬戶
set 客戶編碼 = b.客戶組編號
from ut_syhh_折算率調整_總賬戶 a, ut_syhh_cs_客戶基本資料管理 b
where a.客戶編碼 = b.客戶編碼
and b.客戶層級 = '子賬戶'


錯誤更新:

update ut_syhh_折算率調整_總賬戶
set a.客戶編碼 = b.客戶組編號
from ut_syhh_折算率調整_總賬戶 a, ut_syhh_cs_客戶基本資料管理 b
where a.客戶編碼 = b.客戶編碼
and b.客戶層級 = '子賬戶'

報錯:訊息 4104,層級 16,狀態 1,第 1 行
無法綁定由多個部分組成的標識符 "a.客戶編碼"。

報錯原因:???

 

create view A

as

select * from B

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.