Help with SQL

snoopy4801

Registered User.
Local time
Today, 12:27
Joined
Jun 24, 2009
Messages
18
Ok, so new to SQL, probably a stupid question, but I have a performance database that i need to insert a new row for every employee for the new year and in the column "Fiscal Year" I want it to add 10. (so I would be inserting 850 records total)

The SQL I am using is:
INSERT INTO tbl Performance Tracking ([Fiscal Year]) VALUES ('10');

But it does not seem to be working, i just keep getting syntax errors.
Any Suggestions?:o
 
That would only insert a single record. If you're getting a syntax error, the year field is probably numeric and you wouldn't want the 10 surrounded by quotes. Try the SELECT syntax instead of the VALUES syntax:

INSERT INTO ...
SELECT ...
FROM...

Where the FROM is a table containing the employees you want entered.
 
Ok, so here's where I'm at....Suggestions? Do I need to take out the Inner Join? I'm really only inserting the row on the Performance tracking table, but it's linked to the employees table....:o

SELECT
FROM [tbl Employee Table] INNER JOIN [tbl Performance Tracking] ON [tbl Employee Table].[Empl ID] = [tbl Performance Tracking].[Empl ID];
INSERT INTO tbl Performance Tracking ([Fiscal Year])VALUES (10);
 
Try

INSERT INTO [tbl Performance Tracking] ([Empl ID], [Fiscal Year])
SELECT [Empl ID], 10
FROM [tbl Employee Table]
 
OMG!!! THANK YOU SO MUCH!!!!
That did it. Thank you, thank you!!!
 
LOL! No problem, glad it worked for you.

The spaces in your names are not worth the bother in the long run, by the way. I'd get rid of them if it isn't too late.
 

Users who are viewing this thread

Back
Top Bottom