pass through query syntax for INSERT statement to sql table from access

sql server 2008 linked table:
Trying to insert records from access table to sql server linked table
the following is getting an error message at:

convert([Employees Information2].[Birthdate] & '/2013', 'MM/DD/YYYY')




INSERT INTO dbo_anniv_bd ( [Last Name], [First Name], [Date Hired], [Birthdate] )
SELECT [Employees Information2].[Last Name], [Employees Information2].[First Name], convert([Employees Information2].[Date Hired],'MM/DD/YYYY'), convert([Employees Information2].[Birthdate] & '/2013', 'MM/DD/YYYY')
FROM [Employees Information2];


Thanks
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kelvin SparksCommented:
I don't believe that you can do this. A pass though query is executed on the server, not in Access and SQL Server will have no knowledge of your Access table.

You will have to use an Access INSERT query based on linked tables.


Kelvin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
ok..i cant get this to work either.
INSERT INTO dbo_anniv_bd ( [Last Name], [First Name], [Date Hired], [Birthdate] )
SELECT [Employees Information2].[Last Name], [Employees Information2].[First Name],
format([Employees Information2].[Date Hired],"MM/DD/YYYY"),
format(([Employees Information2].[Birthdate] & "/2013"), "MM/DD/YYYY")
FROM [Employees Information2];

thanks
fordraiders
Kelvin SparksCommented:
What error do you get?
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

FordraidersAuthor Commented:
syntax on these 2 lines:
format([Employees Information2].[Date Hired],"MM/DD/YYYY"),
 format(([Employees Information2].[Birthdate] & "/2013"), "MM/DD/YYYY")
Kelvin SparksCommented:
When inserting to sql server I always format data as "d-mmm-yyyy" That way SQL Server never gets confused as to the day, month and year.

What is the datatype of the columns these two are going into?

The second format is having /2013 concatenated to it. What does the string look like prior to the /2013 being added on the end and what is the datatype?


Kelvin
FordraidersAuthor Commented:
kelvin, I made a setup query to format the fields before inserting records to view as I need first.
then took the new formatted query and used that as the insert query. worked fine.
FordraidersAuthor Commented:
thanks
Kelvin SparksCommented:
Pleased to have helped think it through.


Kelvin
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.