Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why this does not work
Message
From
22/11/2002 17:45:10
 
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00726046
Message ID:
00726062
Views:
15
patindex() returns you the first occurance of "-" in a string. So if it is greater than 0 means there is "-" in the string. Why I am doing this beacuse sometimes value in INS_GROUP1 in header table does not have "-" but in Accounts table(a) this is present. These two are same as "-" must be removed in the query only and not in actual field.

Now substring() + substring() should return me whole field value except the "-" sign and then I compare with h.ins_paynum which is already without "-"
if
patindex("%-%", a.GROUP_ ) > 0

then

h.INS_GROUP1 = substring(a.GROUP_ ,1, (patindex("%-%", a.GROUP_ ) - 1)) + substring(a.Group_,(patindex("%-%", a.GROUP_ )+ 1), datalength(a.Group_)) and
.

I think replace will do the same?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform