aalbetski Posted November 13, 2008 Share Posted November 13, 2008 I am trying to query a table and return only the rows where the value in Column1 can be cast as a uniqueidentifier. I run into problems when the cast fails (Syntax error converting from a character string to uniqueidentifier.) and am stumped as to how to do this. Any ideas? select * from table where Column1 = cast(Column1 as uniqueidentifier) -- this, of course fails when non-guid data is found Column1-------C762C6D6-6167-4B3C-B493-CB1294FF0FFD8E9D557F-B899-4B66-91DB-81DAC3D1D4AE00-11-22-9918-49-e4-33-a1-20-1b-91-a4-40-77-81-6a-7e-d5-df29-70-c8-c2-1e-b9-d9-ee-cb-26-55-04-8d-c9-19-e5 Link to comment Share on other sites More sharing options...
aalbetski Posted November 13, 2008 Author Share Posted November 13, 2008 got it select * from table where column1 like '________-____-____-____-____________' not my first choice, but it works Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.