sql server - How can I copy several columns from table1 into table2 while ALSO defining certain static rows in table2? -


i understand how copy column 1 table another, need + define values of columns in table2 according local variables within stored procedure.

is there way in 1 go? help!

if understand question correctly, can select variables' values inline columns second table, so:

-- pseudo-declarations clarify example create table t1 (   col1 int,   col2 int,   col3 int,   cola varchar,   colb varchar )  create table t2 (   col1 int,   col2 int,   col3 int )  declare @vara varchar declare @varb varchar  [...]  -- can select whatever other values need alongside columns source table insert t1 (col1, col2, col3, cola, colb) select col1, col2, col3, @vara, @varb t2 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -