Data coversion from nvarchar to int possible??

  • Hi

    Could you please tell me if it is possible to use a data conversion transformation from nvarchar to int??

    My data needs such a transformation as my manager does not want to change either of these datatypes.

    Thank you

  • yes it is possible, obviously it will only convert the numeric part of the nvachar string

  • You cannot do it directly .You need to convert it to varbinary first .

    begin

    declare @num nvarchar

    set @num = 'hello'

    select cast (cast(@num as varbinary)as int)

    end

    Abhay Chaudhary
    Sr.DBA (MCITP/MCTS :SQL Server 2005/2008 ,OCP 9i)

  • sudha.2k7 (6/25/2009)


    Hi

    Could you please tell me if it is possible to use a data conversion transformation from nvarchar to int??

    My data needs such a transformation as my manager does not want to change either of these datatypes.

    Thank you

    Does the transformation need to be two way? What does the nvarchar data look like? Some sample data representative of the actual data would be of great help to give you a better answer.

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

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