December 6, 2011 at 10:22 am
Good Morning Guys,
i was wondering if i can do this piece of code programmatically on the query design of MS Access?
DECLARE @TestVal int;
SET @TestVal = 3;
SELECT
CASE 3
WHEN 1 THEN 'First'
WHEN 2 THEN 'Second'
WHEN 3 THEN 'Third'
ELSE 'Other';
END;
if not how can i do it programmatically on MS Access??
Thank you very Much
Noel
December 6, 2011 at 10:31 am
Can you just use a parameterized query?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 6, 2011 at 10:39 am
Check if switch works in a query.
If not embed all the iifs you need.
Edit : Wait are you runnin that query on the MS access engine or on sql server?
December 6, 2011 at 10:53 am
If you are running that in an Access .adp database, it will work just fine. If you are running it in a .mdb, unless it is a PassThrough query, you will need to restructure it to use either IIF statements, or possibly the Switch() functioin, but you can't declare variables like you do in SQL queries.
Wendell
Colorful Colorado
You can't see the view if you don't climb the mountain!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply