Link to home
Start Free TrialLog in
Avatar of ShawnGray
ShawnGray

asked on

MS Visual Studio Query Designer

Is it possible to write an IF statement in Visual Studios Query Designer in the column field?
I've tried a number of iterations that would have worked in MS Access but not luck in Query Designer.
thank you
SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ShawnGray
ShawnGray

ASKER

Does this have to be written in the SQL pane or can it be written in the Criteria pane?

Table: AdvBase
Field: DistNet

Wanting sql equivalent:
NewField: iif([DistNet]>10000,"big","small")
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ValentinoV
Thanks; the quotes "" are being replaced by Query Designer with brackets [].
Execution error: "Invalid column name 'big', Invalid column name 'small'
ValentinoV
Disregard last question.  found I needed to define the expression with table.field
Really appreciate the help and the resource.
Thanks; the quotes "" are being replaced by Query Designer with brackets [].

Ooh, just noticed that I mistakingly used double quotes while they should have been single ones.  In T-SQL, double quotes around a string are equivalent to the square brackets but this means SQL Server thinks you're typing an object name, such as a column or a table.  In your case I think you just wanted hard-coded strings, right?

I'll edit my response above to correct this to avoid confusion for any other readers...

Good to hear you got it working though!
Very good. Thanks for the education.