G
Guest
Hi Guys.
I was wondering if someone could help me. I am currently importing files
from excel into an access database. However, a lot of the data is old and has
to be cleaned up. I am going to have to do this now and anytime I import new
data into the DB.
I am trying to create a macro that will go through the tables and update the
necessary information. I added a RunSQL task to take care some of the edit. I
figure a bunch update statements will do the trick. However I find the RunSQL
task to be rather limited in what it can do... and more importantly I cannot
get it to use a CASE statement.
I am trying to do:
UPDATE testHours
SET GL_month = CASE
WHEN GL_month='1/1/2005' THEN '1'
WHEN GL_month='2/1/2005' THEN '2'
WHEN GL_month='3/1/2005' THEN '3'
WHEN GL_month='4/1/2005' THEN '4'
WHEN GL_month='5/1/2005' THEN '5'
WHEN GL_month='6/1/2005' THEN '6'
END
----------------------
When I run this, I get a missing operator error, but I know the syntax is
correct... Can anyone help me figure this out? Or is there a better way to be
doing this?
I appreciate any assistance you could offer.
Thanks,
-Michael
I was wondering if someone could help me. I am currently importing files
from excel into an access database. However, a lot of the data is old and has
to be cleaned up. I am going to have to do this now and anytime I import new
data into the DB.
I am trying to create a macro that will go through the tables and update the
necessary information. I added a RunSQL task to take care some of the edit. I
figure a bunch update statements will do the trick. However I find the RunSQL
task to be rather limited in what it can do... and more importantly I cannot
get it to use a CASE statement.
I am trying to do:
UPDATE testHours
SET GL_month = CASE
WHEN GL_month='1/1/2005' THEN '1'
WHEN GL_month='2/1/2005' THEN '2'
WHEN GL_month='3/1/2005' THEN '3'
WHEN GL_month='4/1/2005' THEN '4'
WHEN GL_month='5/1/2005' THEN '5'
WHEN GL_month='6/1/2005' THEN '6'
END
----------------------
When I run this, I get a missing operator error, but I know the syntax is
correct... Can anyone help me figure this out? Or is there a better way to be
doing this?
I appreciate any assistance you could offer.
Thanks,
-Michael