Tuesday, March 27, 2012

Creating a View help

i have a table which has 2 columns 1 'report' 2 'part'

now in my 'report' cloumn i have # with 6 digits ex. '111111' and 'part' has '1, 2, 3, 4,..to 50'

i want to create a view that will put them together in format like this:

1111110001

1111110002

1111110003 .. and on

it needs to be in 10 digits.

is there anyway i can create a View or may be a column in the table which can create the #'s in this format.

Try this:

SELECTRIGHT('00000'+Convert(nvarchar(6),[report]),6)+RIGHT('00000'+CAST([part]asNvarchar(6)), 4)AS TenDigitsString

FROM CAG

|||

Thanx limno ur example worked out.

No comments:

Post a Comment