February 6, 2013 at 11:37 pm
SetFormattedValue =CASE
When rg.ReferredFieldType='NUM'
Then CAST(#PointedMslValues.Value AS NUMERIC(18,cAST(rg.ReferredDecimalPoints) )
more cases .
END
I am generating a dynamic query which is giving error actually it requires integer value while casting not a column name
February 7, 2013 at 12:56 am
Can you able to say what is type of FormattedValue column.
FormattedValue column strict to type so you can not assign other type except type of FormattedValue column.
Thanks,
Nishant
ID:nishantcomp2512
February 7, 2013 at 1:19 am
ALI100 (2/6/2013)
SetFormattedValue =CASE
When rg.ReferredFieldType='NUM'
Then CAST(#PointedMslValues.Value AS NUMERIC(18,cAST(rg.ReferredDecimalPoints) )
more cases .
END
I am generating a dynamic query which is giving error actually it requires integer value while casting not a column name
If you are creating a dynmaic query then try the output be like NUMERIC (18,9) ..so use concatenation of strings..
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
February 7, 2013 at 1:23 am
ALI100 (2/6/2013)
SetFormattedValue =CASE
When rg.ReferredFieldType='NUM'
Then CAST(#PointedMslValues.Value AS NUMERIC(18,cAST(rg.ReferredDecimalPoints) )
more cases .
END
I am generating a dynamic query which is giving error actually it requires integer value while casting not a column name
CAST(rg.ReferredDecimalPoints AS datatype)
However, it's unlikely to be as simple as this because it will have to be stringified to work. Can you post the whole query?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 7, 2013 at 1:42 am
FormattedValue VARCHAR(MAX)
February 7, 2013 at 5:29 am
Thanks Grasshopper for quick reply.
you can not use cAST(rg.ReferredDecimalPoints) to add decimal point to numeric data type.you can not use variable inside numeric bracket.you have to pass static value.
you can accomplish this by Substring function in sql.select only few char after decimal point from varchar data.
i thinks to pick only few char after decimal point is easy that casting to impossible numeric type as we want data should be in varchar.
Nishant
ID:nishantcomp2512
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply