kamleshmistry
asked on
more quick points sql server -- iif
I want to create a formula field.
if area code is blank then formula should be
[LocalNumber]
if area code is not blank then formula should be
[AreaCode] + '-' + [LocalNumber]
How do I do this in sql server formula field?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Are you all sure?
By the way, what I am doing is in the design table section, I am creating a new column.
I create a new column, and then in the Formula textbox entry, I start typing a formula...
It is a single line text-box...
By the way, what I am doing is in the design table section, I am creating a new column.
I create a new column, and then in the Formula textbox entry, I start typing a formula...
It is a single line text-box...
ASKER
See above comment,
When I enter a simple forumla like this:
CASE WHEN TRUE Then '-' ELSE '' END
I get the error that the formula is not a valid formula
The above is exactly what I typed into the Formula text box in the columns tab for a new column in the design table screen....
When I enter a simple forumla like this:
CASE WHEN TRUE Then '-' ELSE '' END
I get the error that the formula is not a valid formula
The above is exactly what I typed into the Formula text box in the columns tab for a new column in the design table screen....
ASKER
P.S.
I AM NOT DOINT A SQL SELECT
I AM NOT DOINT A SQL SELECT
P.S.
THEN WHY ARE YOU POSTING IN THE SQL TA...this sounds like a vb.net question
THEN WHY ARE YOU POSTING IN THE SQL TA...this sounds like a vb.net question
ASKER
no, no...
not a vb.net question.
a sql server question.
create a new database table and create a new field.
there is a text box for "formula" to create a formula field.
I believe the way this works is that no storage is used for formula fields. It is evaluated and displayed, and can be made available to dataset, but does not use up any hard disk storage...
Question is related to Sql server...
not a vb.net question.
a sql server question.
create a new database table and create a new field.
there is a text box for "formula" to create a formula field.
I believe the way this works is that no storage is used for formula fields. It is evaluated and displayed, and can be made available to dataset, but does not use up any hard disk storage...
Question is related to Sql server...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
vb.net supports iif
iif( condtion, true part, false part)
where true part is an expression
and
false part is an expression