Microsoft Sql Server Error 8169
(Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsTroubleshootingCommunityForums Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Asked by: Error Msg 8169 on query of dbo. View sql conversion failed when converting from a character string to uniqueidentifier. SQL Server > Transact-SQL Question 0 Sign in to vote The top conversion failed when converting from a character string to uniqueidentifier. sql server 2012 query in illustration on the View dbo_CONTACT_OPPORTUNITY runs fine but the bottom query dbo.OPPORTUNITY returns the error message sql uniqueidentifier below. I listed the columns for dbo.OPPORTUNITY to the left thinking that one or more of the columns in the View needs to be handled differently in order to make the query work. What am I doing wrong? Msg 8169, Level 16, State 2, Line 1 Conversion failed when converting from a character string to uniqueidentifier. Sunday, July 29, 2012 12:48 PM Reply | Quote All replies 0 Sign in to vote Would you please share the TSQLdefiningthe view also to narrow down the problem in the second query can you try SELECT OPPORTUNITY.OPPORTUNITYID FROM OPPORTUNITY SELECT OPPORTUNITY.CONTACTID FROM OPPORTUNITY SELECT OPPORTUNITY.STAGEID FROM OPPORTUNITY Regards, Ahmed Ibrahim SQL Server Setup Team My Blog This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread. Sunday, July 29, 2012 1:04 PM Reply | Quote 1 Sign in to vote This error occurs when you try to convert a string value (e.g. nvarchar) to a uniqueidentifier but the string isn't in the correct format. The string represntation of a uniqueidentifier in SQL Server is 32 hex characters with dash delimiters, optionally enclosed with braces: SELECT CAST(N'00000000-0000-0000-0000-000000000000' AS uniqueidentifier); SELECT CAST(N'{00000000-0000-0000-0000-000000000000}' AS uniqueidentifier); I suspect your view may specify a JOIN or WHERE clause condition that compares CONTACTID or OPPORTUNITYID with a a column data type if a lower precidence. I that case, SQL Server will implicitly convert the column to uniqueidentifier for the comparison. This will res
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0c7b83c9-e7dd-4cce-9b20-4fa0aed0612e/error-msg-8169-on-query-of-dbo-view?forum=transactsql million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQL Server: Conversion failed when converting from a character string to uniqueidentifier up vote 1 down vote favorite I've been banging my head against a wall for the past hour trying to figure this out, sql is giving http://stackoverflow.com/questions/3242613/sql-server-conversion-failed-when-converting-from-a-character-string-to-uniquei me the following error Msg 8169, Level 16, State 2, Procedure GetAppointmentsByProfessionalName, Line 6 Conversion failed when converting from a character string to uniqueidentifier. when this stored procedure is executed -- ============================================= -- Create date:
to uniqueidentifier. Severity level: 16. Description: This error message appears when you try to convert an invalid character string http://www.sql-server-performance.com/2009/conversion-failed-when-converting-to-uniqueidentifier/ to uniqueidentifier. Consequences: The T-SQL statement can be parsed, but causes the error at runtime. Resolution: Error of the Severity level 16 are generated by the user https://klo2k.wordpress.com/2007/03/30/sql-error-solved-syntax-error-converting-from-a-character-string-to-uniqueidentifier/ and can be fixed by the SQL Server user. The statement cannot be run this way. Only valid character strings can be converted to uniqueidentifier. Versions: All versions sql server of SQL Server. Example(s): SELECT CAST('1′ AS uniqueidentifier) Remarks: In the above example we try to convert the character string '1′ to uniqueidentifier. This raises the error. ASK A QUESTION Tweet Array Errors No comments yet... Be the first to leave a reply! Leave a Reply Click here to cancel reply. Popular Latest Tags Setting conversion failed when up Transactional Replication in SQL Server 2008 R2. November 30, -0001 Backing Up a SQL Server Database Directly Onto a Remote Server November 30, -0001 Recovering a SQL Server Database from Suspect Mode November 30, -0001 SQL Server T-SQL Tuning - NOT IN and NOT Exists November 30, -0001 SQL Server T-SQL Tuning - Temp Tables, Table Variables and Union November 30, -0001 SQL Server Audit Walkthrough October 10, 2016 SQL Server Logical Reads – What do they really tell us? October 4, 2016 Physical Join Operators in SQL Server - Hash Operator September 21, 2016 Physical Join Operators in SQL Server - Merge Operator August 25, 2016 Techniques to Monitor SQL Server memory usage August 12, 2016 Forum posts... 2008 R2 2012 Agent AlwaysOn Analysis Services Backup Clustering Data Mining deadlock Denormalization Disaster Recovery Email Entity Framework Excel Geo high availability Identity Identity Column index Jobs Log Shipping mail Monitoring Oracle Query Query Plan range Replication Reporting Services Report Manager Restore Securi
"Syntax error converting from a character string to uniqueidentifier." 2007-03-30 -- klo2k If any of you ever come across this kind of error when running a SQL query to query tables: Server: Msg 8169, Level 16, State 2, Line 1
Syntax error converting from a character string to uniqueidentifier. Make sure you cast the matching field to the correct data type - for instance (Querying for SQL Reporting's report subscriptions):
SELECT msdb.dbo.sysjobs.name, msdb.dbo.sysjobs.enabled, ReportServer.dbo.Catalog.Name, ReportServer.dbo.Catalog.ExecutionTime, ReportServer.dbo.Schedule.StartDate, ReportServer.dbo.Schedule.NextRunTime FROM ReportServer.dbo.Schedule INNER JOIN ReportServer.dbo.ReportSchedule ON ReportServer.dbo.Schedule.ScheduleID = ReportServer.dbo.ReportSchedule.ScheduleID INNER JOIN ReportServer.dbo.Catalog ON ReportServer.dbo.ReportSchedule.ReportID = ReportServer.dbo.Catalog.ItemID INNER JOIN msdb.dbo.sysjobs ON msdb.dbo.sysjobs.name = cast(ReportServer.dbo.Schedule.ScheduleID as sysname)
In the example above, note for the last line: ON msdb.dbo.sysjobs.name = cast(ReportServer.dbo.Schedule.ScheduleID as sysname) "ReportServer.dbo.Schedule.ScheduleID" is cast to sysname - which is the data type for "msdb.dbo.sysjobs.name" I guess if you think about this, it's rather obvious you can't compare apple to oranges… Like this:Like Loading... Related Posted in Software. Leave a Comment » Leave a Reply Cancel reply Enter your comment here... Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account. (LogOut/Change) You are commenting using your Twitter account. (LogOut/Change) You are commenting using your Facebook account. (LogOut/Change) You are commenting using your Google+ account. (LogOut/Change) Cancel Connecting to %s Notify me of new comments via email. « My switch to OggVorbis Windows zero-day exploit - ANIExploit » Proudly powered by WordPress Archives February 2011 September 2010 May 2010 January 2010 December 2009 October 2009 September 2009 August 2009 May 2009 April 2009 March 2009 February 2009 January 2009 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 20