Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2013-10-21 : 17:20:09
|
HI I have to select rows from a tableif the first 2 characters of a 12 char column are 'GB'Select BFKEYC from table whereI have a hokey way of doing it but it looks embarrassing: BFKEYC GT 'GA9999999999' AND BFKEYC LT 'GC' |
|
bitsmed
Aged Yak Warrior
545 Posts |
Posted - 2013-10-21 : 17:38:38
|
where bfkeyc like 'GB%' |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-10-22 : 00:21:49
|
Two approaches for the above requirement are:1) where bfkeyc like 'GB%'2) WHERE LEFT( bfkeyc, 2) = 'GB'--Chandu |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-10-22 : 06:10:39
|
quote: Originally posted by bandi Two approaches for the above requirement are:1) where bfkeyc like 'GB%'2) WHERE LEFT( bfkeyc, 2) = 'GB'--Chandu
Method 1 is good if there is an index on that columnMadhivananFailing to plan is Planning to fail |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-22 : 08:04:22
|
GT LT? Are you using T-SQL? having seen these functions so far.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2013-10-23 : 08:16:42
|
this is db2 as400 they still have these. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-23 : 08:34:36
|
Hmm..then you are in wrong forum.This is MS SQL Server forum------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2013-10-23 : 09:02:50
|
Yes but I am using Crystal reports which is sql server |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-23 : 09:08:51
|
quote: Originally posted by AdamWest Yes but I am using Crystal reports which is sql server
Crystal Reports is just a component of sql server. But if you're using AS400 as backend the query syntax would be different from T-SQL which is MS SQL Servers programming language. Thats why I suggested you to try in AS400 related forums as there are not much experts on AS400 here------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|