Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tngtng
Starting Member
7 Posts |
Posted - 2010-04-07 : 04:17:24
|
Hi, I have 2 tables: Project (with key=Reference) & Users. I want to add users which group is 'Admin' or 'Buyer' and project_reference=(new Project.Reference added) into Users table.Information about these users could be found in Users table, with Group contains 'Admin' or 'Buyer' and Project_reference=null.Which means:User table: name Group Project_Reference Email ... A X,Y,Admin null B Z,Buyer null A X 16 A Admin 17new lines: A Admin (SELECT SCOPE_IDENTITY()) B Buyer (SELECT SCOPE_IDENTITY())My request is: INSERT INTO [Projetc] ([Name], [Budget]) VALUES (@name,@budget)INSERT INTO [Users] ([Name],[Group],[Email], [Reference Projet]) select Name, Group, Email from Users where ([Project_Reference] is null) and Group='Admin' + (SELECT SCOPE_IDENTITY())1st, I don't know how to search a string in another string (search 'Admin' in 'X,Y,Admin' or in 'Z,Buyer'...)2nd, the insert request doesn't work, error message: "The selection list of Insert has less element than the number of values in select query"Someone could help me, please? |
|
|
|
|
|
|