Implicit conversion from data type ntext to varchar is not allowed

  • I'm doing a simple variable assignment from a "between quotes" text to nvarchar and I keep getting the following error:

    Msg 257, Level 16, State 3, Line 1

    Implicit conversion from data type ntext to varchar is not allowed. Use the CONVERT function to run this query.

    This is what I'm doing:

    Declare @Outputfile nvarchar(128)

    Select @OutPutFile='D:\Temp\ProfilerDailySnapshot\'

    I have tried to use cast and convert but the problem still remains.

    I have tried the following:

    Select @OutPutFile=Cast('D:\Temp\ProfilerDailySnapshot\' as nvarchar(128)

    also --> Select @OutPutFile=Convert(nvarchar(128), 'D:\Temp\ProfilerDailySnapshot\' )

    I'm running SQL 2000 (by the way). This same code works fine on sQL 2005.

    any ideas?

    Thank you much!

  • Paul Perez (1/8/2009)


    I'm doing a simple variable assignment from a "between quotes" text to nvarchar and I keep getting the following error:

    Msg 257, Level 16, State 3, Line 1

    Implicit conversion from data type ntext to varchar is not allowed. Use the CONVERT function to run this query.

    This is what I'm doing:

    Declare @Outputfile nvarchar(128)

    Select @OutPutFile='D:\Temp\ProfilerDailySnapshot\'

    I have tried to use cast and convert but the problem still remains.

    I have tried the following:

    Select @OutPutFile=Cast('D:\Temp\ProfilerDailySnapshot\' as nvarchar(128)

    also --> Select @OutPutFile=Convert(nvarchar(128), 'D:\Temp\ProfilerDailySnapshot\' )

    I'm running SQL 2000 (by the way). This same code works fine on sQL 2005.

    any ideas?

    Thank you much!

    Have you tried this:

    Declare @Outputfile nvarchar(128)

    Select @OutPutFile = N'D:\Temp\ProfilerDailySnapshot\'

  • Sorry...as soon as I posted this thing...I figured out what the problem was. It had nothing to do with the assignment I was looking at. It had to do with an insert I was doing at the end of proc. I was inserting ntext data into a varchar field and SQL was simply that it could not do that. I use the convert function on my insert statement and fixed that.

    Sorry about that! thank a lot for your quick response!

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

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