C# Select By GUID

Posted on 2005-05-09
Medium Priority
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
  • 2
LVL 75

Accepted Solution

Anthony Perkins earned 2000 total points
ID: 13964583
You can use:
  "SELECT * FROM MyTable WHERE GUID = '19D00616-1903-4376-AFC3-017881B412AB'
LVL 75

Expert Comment

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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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
Suggested Courses

840 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