sqlserver 插入表操作附帶時間

2021-09-27 04:24:20 字數 530 閱讀 4523

昨天在寫乙個任務的時候,發現要把乙個表中的資料插入到另乙個表中,但是這個表少了乙個時間字段,於是異想天開,直接getdate() as 需要的字段即可插入了~

直接上示例**

insert into [auto].[data_qc_arima_schedule](qc_record_id, datasource, update_at, next_run_date, status)

(select id, datasource,getdate() as update_at, getdate() as next_run_date, status='pending' from [auto].[data_qc_recordsnew]

except

select qc_record_id as id, datasource, getdate() as update_at, getdate() as next_run_date, status='pending' from [auto].[data_qc_arima_schedule]

)

SQL Server 表結構操作

一 建立表 直接定義主外來鍵 create table wallet id varchar 36 primary key,money decimal 18,2 not null name varchar 36 default 餘額 member id varchar 36 foreign keyre...

SQL Server 臨時表插入基礎語法

有關臨時表的資料插入 1 把臨時表中的資料插入到另乙個表中 insert into 表 select from temp 2 把乙個表中字段複製到臨時表中 select into temp from 表 where 3 本地臨時表的名稱以單個數字符號 打頭 它們僅對當前的使用者連線是可見的 4 當使...

鍊錶插入操作

輸入格式 第一行輸入是乙個整數 n 1 n 100 表示一共要執行 n 次插入操作。接下來輸入 n 行,每行輸入兩個整數 p 和 q 0 p,q 100 其中 p 表示結點插入鍊錶中的位置 從下標為 0 開始 q 表示插入元素的值,兩個整數之間用乙個空格隔開,行末沒有空格。輸出格式 輸出一共 n 1...