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
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Selecting certain digits from an integer

Author  Topic 

JGaston
Starting Member

8 Posts

Posted - 2013-09-26 : 18:47:06
I am building a report that will prompt for an integer skuNumber.

I would like to filter based on certain digits of this number.

For instance -

if 2nd digit of skuNumber is 3, display X
if 2nd digit of skuNumber is 4, display Y
if 2nd digit of skuNumber is 5, display Z

Can't figure out how to dissect the integer i.e. denote 2nd digit, 3rd digit and so on.

Thanks!!!

J

JGaston
Starting Member

8 Posts

Posted - 2013-10-03 : 11:38:11
nothing?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-04 : 04:52:55
use SubString() function

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2013-10-04 : 05:32:52
Do you know what size the integer is? Is it a fixed length?
Otherwise you need to convert to character format - will it be an issue if there is a 0 as the first character?

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -