Problem with convert datatype

  • Hi

    i am using sql server to convert data type.here critical is my source data column

    studentno nvarchar(50) i have been trying this to convert "Bigint" data type but it shows

    error.tell me which datatype is sutible for my column studentno

    here my data is

    studentno nvarchar(50)

    -----------

    2.00701E+16

    2.00706E+16

    2.00806E+16

    2.00712E+16

    2.00703E+16

    but i want output like this

    2007010000000000

    2007060000000000

    2008060000000000

    2007120000000000

    2007030000000000

    thanks

    murali

  • You will need to cast to a float first.

    SELECT CAST(CAST(N'2.00701E+16' AS float) AS bigint)

  • Thanks Ken

    its working

    and what is 'N' here

    Thanks

    murali

  • The 'N' just means a nchar constant as opposed to a char constant.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply