View changes nvarchars to varchars in SQL Server 2008

Posted by Traples on Stack Overflow See other posts from Stack Overflow or by Traples
Published on 2010-06-01T20:07:59Z Indexed on 2010/06/01 20:13 UTC
Read the original article Hit count: 170

Filed under:
|
|
|

I have a view in a SQL Server 2008 db that simply exposes about 20 fields of one table to be consumed via ODBC to a client. When I tried to replicate this view in another database, the client could not consume the data source.

Then I noticed some weirdness. The columns in the view are shown, in SQL Server Management Studio, to be varchar(100), while the columns in the table are defined as nvarchar(100). There are no CAST or CONVERT statements in the view, it is a simple SELECT statement.

Example:

Table -> Columns:

Desc1 (nvarchar(100), null)

View -> SELECT TOP 100 PERCENT Desc1 FROM... Columns:

Desc1 (varchar(100), null)

Any ideas why the columns are defined as varchar in the view instead of nvarchar?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server