Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Mass Insert using Except
-- ///////////SCHEMA/////////////////////////////////////////////////// CREATE TABLE Animals ([animal] varchar(255), [legs] int, [colour] varchar(255)) ; CREATE TABLE ObjectPermissions ([animal] varchar(255), [permission] varchar(255), [record] int, [test1] varchar(255), [test2] varchar(255), [test3] varchar(255) ) ; INSERT INTO Animals ([animal], [legs], [colour]) VALUES ('cat', 4, 'red'), ('bird', 2, 'yellow'), ('dog', 4, 'red'), ('deer', 4, 'red'), ('fish', 0, 'blue'), ('dingo', 4, 'yellow') ; -- //////////////////////////////////////////////////////////////////// DECLARE @applicationId INT SET @applicationId = 0 insert into ObjectPermissions select animal, '_SuperUser', 99, 'test1', 'test2', 'test3' from animals EXCEPT select animal, '_SuperUser', 99, 'test1', 'test2', 'test3' from animals where animal NOT IN ('dog', 'deer', 'dingo') select * from animals select * from ObjectPermissions
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Workers information
BC160401693
2021-03-23_LeetCodeSQL
Demo
store
Demo
Use the right tool to get identity values back after an insert
Cinema latinoamericano
dynamic pivot
Función Borrar carácter inicial repetido
Please log in to post a comment.