Variables In T-sql
I have only 1 column in my table, in this table there are inputs like 990x70, 980x50. I need the values left and right of the 'x' to calculate inches of these 2 values. With this c
Solution 1:
Now, admittedly, I'm not totally clear on what you're asking. But it sounds like something like this should work:
SELECTCONVERT(NUMERIC(18,1), SUBSTRING([Values], CHARINDEX('x', [Values]) +1, LEN([Values]))) /2.54,
CONVERT(NUMERIC(18,1), SUBSTRING([Values], 1, CHARINDEX('x', [Values]) -1)) /2.54FROM myTable
That should just do the same thing as you're doing, but without any of the variables (which are, in your usage, inherently one-dimensional).
Post a Comment for "Variables In T-sql"