I have a field that I want to compute based on a string and the ID generated when a record is inserted. Basically when a record is save with ID = 1, I need the computed field to read ‘string_1’ and so on. I am trying this is my formula (('PV'+'_')+ID) where PV is the string and ID is the primary key field in the same row as the data inserted but I’m getting a formula error. If I add quotes around ID then I just get PV_ID which is wrong. Any idea how I can reference the ID field in my formula and fetch the value?
here is my table row structure(ID,Computedfield,data1,data2). i need computedfield to have the value of the ID field concatenated with a string. any help appreciated
EDIT
Using SQL SERVER 2008 R2 Standard
I have a field that I want to compute based on a string and
Share
Your question isn’t totally clear on whether that prefix string is a string literal, or the contents of another column.
If it’s a literal, you should be able to say:
If it’s a string contained in another column, you should be able to define it like this
assuming
PVis the column (of typeVARCHAR) containing the prefix string.The main point is: since you’re mixing a literal string, and an
INTvalue, you need toCASTthe INT to a string first before being able to concatenate those two.