unable to convert unique identifier

Vineet S 1,070 Reputation points
2024-06-12T07:17:37.1633333+00:00

Hi Team,

unable to convert this value as an unique identifier and getting null values

SELECT try_convert(uniqueidentifier,''9UIC32D1-932-4V03-45E9-FGSGDASASDATY'')testid

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,589 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,290 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 27,881 Reputation points
    2024-06-12T07:53:10.2466667+00:00

    Hi @Vineet S

    Because the value is not valid GUID type. TRY_CONVERT returns NULL when the convert fail.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    1 person found this answer helpful.
    0 comments No comments

  2. Olaf Helper 44,931 Reputation points
    2024-06-12T07:59:06.7766667+00:00

    ''9UIC32D1-932-4V03-45E9-FGSGDASASDATY'')

    A GUID can have numbers and letters between A-F, but never T or Y; your GUID is invalid.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.