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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Wild Characters?

Author  Topic 

jp2code
Posting Yak Master

175 Posts

Posted - 2008-07-22 : 10:14:19
I know how to dig data from the SQL 2000 Server using the % wild card, but is there a way to specify certain characters to be a wild character?

I need this for Part Number searches, but as an example, I will show you a date (everyone is familiar with a date):

Say I wanted all of January 2006's data. Instead of
('12/31/2005' < DateTime) AND (DateTime < '02/01/2006')
I'd like to know if there is something like
(DateTime Like '01/??/2006')

Management is asking for the ability to search for specific part numbers using complex queries, and I am not sure if this can be done.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-22 : 10:17:13

What is the datatype of the column you want to search for?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jp2code
Posting Yak Master

175 Posts

Posted - 2008-07-22 : 10:53:50
It is just a string (unlike the DateTime fields). Probably a bad example to use, but easier to see what I am being asked to accomplish without getting others to try to figure out our complicated Serial Number format.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-22 : 10:59:37
quote:
Originally posted by jp2code

It is just a string (unlike the DateTime fields). Probably a bad example to use, but easier to see what I am being asked to accomplish without getting others to try to figure out our complicated Serial Number format.


You need to post some sample data for better understanding

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-07-22 : 11:30:19
Are you sure the datatype of your column is a string? And not a DateTime? If so, simple ranges like:

('12/31/2005' < DateTime) AND (DateTime < '02/01/2006')

would not return any data -- There are no values between the string '12/31/2005' and '02/01/2006', since '12/31/2005' is greater than '02/01/2006' when doing a string comparison.


- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

jp2code
Posting Yak Master

175 Posts

Posted - 2008-07-22 : 11:30:44
I searched elsewhere to find what I wanted, dude. It was just too hard to explain what I wanted from you.

What I needed was the underscore ('_'). I did not know how to specify an individual character as a wildcard.

Nevermind. I solved it myself.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-22 : 13:46:53
quote:
Originally posted by jp2code

I searched elsewhere to find what I wanted, dude. It was just too hard to explain what I wanted from you.

What I needed was the underscore ('_'). I did not know how to specify an individual character as a wildcard.

Nevermind. I solved it myself.


Cool . only you could solve it by the way you explained the entire problem.
Go to Top of Page
   

- Advertisement -