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 |
|
dkekesi
Starting Member
38 Posts |
Posted - 2011-03-31 : 11:45:08
|
| Hi All,I have a table with 2 columns: IntervalBegin and IntervalEnd. These columns are filled with data likeIntervalBegin IntervalEnd-----------------------------------AC7S-V000001 AC7S-V999950AC7S-W000001 AC7S-W501050AC8SA0000001 AC8SA0010000AC8SA0010001 AC8SA0510000AD7E-A000001 AD7E-A999950AD7E-B000001 AD7E-B999950AD7E-C000001 AD7E-C999950AD7E-D000001 AD7E-D999950These are intervals for valid account identifiers.I need to design a stored procedure that returns true if the account identifier supplied in a parameter is between one of the intervals (inclusive). For example with the data above supplying AC7S-W000002 to the SP it would return true, but would return false for AD7E-A999951.The problem is that the structure of the identifiers are different as you can see in the example above.Is this totally hopeless and am I better off writing the algorithm on the client side?Thanks for the help in advance.Br,DanielBest Regards,Daniel |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-31 : 11:48:09
|
[code]IF EXISTS (SELECT * FROM atable WHERE IntervalBegin <= @parameter AND IntervalEnd >= @parameter ) PRINT 'TRUE'ELSE PRINT 'FALSE'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
dkekesi
Starting Member
38 Posts |
Posted - 2011-04-01 : 10:53:23
|
| Perfect, thanks a lot for the help.Best Regards,Daniel |
 |
|
|
|
|
|