convert

  • i have two table.In my source table i have column with Nvarchar(64) . and i destination i have same column with varchar(10).similarly i have another column in source with Nvarchar(64) and in destination i have same column with varchar(64).how i can convert that.

  • weston_086 (3/13/2012)


    i have two table.In my source table i have column with Nvarchar(64) . and i destination i have same column with varchar(10).similarly i have another column in source with Nvarchar(64) and in destination i have same column with varchar(64).how i can convert that.

    First column: cast(substring(col1,1,10) as varchar(10))

    Second column: cast(col2 as varchar(64))

    Either that or make the columns the same data type between the two tables, preferably make the columns in destination table the same as the source.

  • Also to add on from Lynn you could use the convert function which does the same job as cast

    First column: CONVERT(VARCHAR(10), SUBSTRING(col1,1,10))

    Second column: CONVERT(VARCHAR(64), col2)

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

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