Viewing 15 posts - 11,281 through 11,295 (of 13,872 total)
Then the CAST solution is probably the best for you, eg:
DECLARE @Int1 INT
SET @int1 = 454638
SELECT @Int1, LEFT(CAST(@int1 AS VARCHAR(20)),3)
June 28, 2011 at 5:23 am
You have stated your problem and received a solution - if the solution is not what you require, please describe why, so that the next solution can give you what...
June 28, 2011 at 4:41 am
Although you may have solved this problem in the short term, you may be storing up problems for yourself in the medium term. If two or three more code/description pairs...
June 28, 2011 at 2:21 am
Do you have a question?
June 27, 2011 at 11:12 pm
thava (6/27/2011)
for give me phil i think sscrazy is your name, i said that statement to jayanth
Haha, no problem. SSCrazy would frequently be a better name for me than Phil...
June 27, 2011 at 5:21 am
thava (6/27/2011)
hi SSCit is the same thing what i did but in a different way
--
It is not. Your method would allow invalid ranges to be inserted, mine would not.
But...
June 27, 2011 at 4:58 am
Jayanth_Kurup (6/27/2011)
Phil Parkin (6/27/2011)
Something like this:
declare @MaxToPoint Intselect @MaxToPoint = max(ToPoint) from PLevel
If @frmPoint <= @MaxToPoint then --> error
Hi
This would remove scope for inserting a range between 1 and...
June 27, 2011 at 4:48 am
Something like this:
declare @MaxToPoint Int
select @MaxToPoint = max(ToPoint) from PLevel
If @frmPoint <= @MaxToPoint then --> error
June 27, 2011 at 4:22 am
I am assuming that selecting MAX(ToPoint) and making sure that your range is above that is not adequate?
June 27, 2011 at 3:50 am
Please mark the bit that is creating the error. 'Third step' does not make it clear to me.
Also, please post the text of the error message.
June 24, 2011 at 5:21 am
It's not easy to understand what you are asking - can you provide sample input data, with desired output?
June 24, 2011 at 2:05 am
GilaMonster (6/23/2011)
The first there's a function applied to the column. That makes the predicate non-SARGable, meaning SQL can NEVER use an index seek operation...
June 23, 2011 at 11:21 am
As you are looking from the start of the column, you can use this
WHERE LEFT(fldField,3) = 'NCB'
- just a little tidier and avoids wildcards.
June 23, 2011 at 9:58 am
Here is proof that "it works"
DECLARE @a CHAR(1) = CHAR(10)
SELECT @a, ASCII(@a), REPLACE(@a,CHAR(10),' '), ASCII(REPLACE(@a,CHAR(10),' '))
Now please try to explain how your problem is different from what has been suggested.
June 23, 2011 at 9:40 am
Viewing 15 posts - 11,281 through 11,295 (of 13,872 total)