C# Select By GUID

Posted on 2005-05-09
Last Modified: 2012-06-22
I have a column in my table named, Guid.  I need to select a row from this table based on this guid.

I have tried

  "SELECT * FROM MyTable WHERE (Guid = '{19D00616-1903-4376-AFC3-017881B412AB}');"

but I receive a generic error.  (Note: When I try "SELECT * FROM MyTable;" it works fine).

Is there another syntax I should be using to specify the GUID?  If I try and use a datetime field as criteria it works fine also.
Question by:eternal_21
    LVL 75

    Accepted Solution

    You can use:
      "SELECT * FROM MyTable WHERE GUID = '19D00616-1903-4376-AFC3-017881B412AB'
    LVL 75

    Expert Comment

    by:Anthony Perkins
    Also, please follow-up on this abandoned question:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now