Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

SQL Enterprise manager connected to SQLExpress - Conversion failed when converting a char to a uniqueidentifier

Hi..
I registered a SQLExpress DB in SQL 2008 Enterprise manager.
When I run some of the views I get
CONVERSION FAILED WHEN CONVERTING FROM CHARACTER STRING TO UNIQUEIDENTIFIER
Any ideas... The App that uses SQLExpress works fine.
How can I query the views/tables?
thx
0
JElster
Asked:
JElster
1 Solution
 
derekkrommCommented:
Can you give a little more detail? Like what the data is, the view or query, etc?
0
 
Chris MConsulting - Technology ServicesCommented:
It's possible you are getting this error by querying a view, not a table and either the view was not written well and so it's giving you data-type conflicts or it was written well but the data-type of one of the fields in the parent table which the view queries was changed from one type to another.

So it's possible that the view expects character (CHAR, VARCHAR or NVACHAR) data which it converts to data-type uniqueidentifier before displaying it.

To resolve this, run sp_helptext 'schema.view_name' on the view and see which tables it queries then correct the view's text so that it can query the parent tables without any problem.

Once the problem is fixed, you may alter the view to reflect the new one.
Be sure to perform sufficient testing using the data available. Also keep the old and new view syscomments somewhere in a file so that you can roll back to the original view format whenever you want.

Use the snippet attached to see the listing of the different tables and views in your database.

Regards,
Chris
SELECT TABLE_NAME As [Object Name], TABLE_TYPE as [Object Type], TABLE_SCHEMA as [Schema], 
		TABLE_CATALOG As [Database]
FROM information_schema.tables where table_type in ('VIEW', 'BASE TABLE')
order by TABLE_NAME asc

Open in new window

0
 
JElsterAuthor Commented:
The view is based on a UDF... It's selecting from a UDF.  which I can't open in Enterprise manager.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now