Skip to content

Tag: sql-server

Return first element of each cell

I have a table like this: Id Description Recipient 1 lipsum 35235 2 dolor est 123, 456, 2432 3 Lorem Ipsum 143243, 34, 2344 And I’d like an output like this: Id Description Recipient RecipientId 1 lipsum 35235 35235 2 dolor est 123, 456, 2432 123 3 Lorem Ipsum 143243, 34, 2344 143243 I need to join a ta…

Difference between delete statements

vs. Answer The logical conditions of the two statements are different. The first statement will delete any row in TableA if both it’s Field1 and Field2 correspond to the equivalent columns of a row in TableB. The second statement will delete any row in TableA if the value of Field1 exists in Field1 of T…

Best way to filter data for a given range

I need to find Claims from a given table having a procedure code between the range ‘Q5000’ and ‘Q5090’. I am able to write a function for Int codes but am not sure how to best deal with characters range in SQL Server? I can manually write all the codes and filter them but is there any …

Sql Query with NOT LIKE IN WHERE CLAUSE

I have two tables emails and blockedSender I am trying to remove blocked sender from the email query. e.g. emails table: user_id from_address 1 name-1 <email-1@address.com> 2 name-2 <email-2@address.com> blockedSender table: blocked_address email-1@address.com Here I want to return all elements fr…

Get DateTime from text

How to separate and display only the DateTime from the string? I have a column that holds this data: I used this query to separate out the time: and it returned the same lines. String didn’t get filtered When I tried using this statement: I got this error Conversion failed when converting date and/or ti…

SQL Where clause order

I have this SQL query: It runs fine and displays the expected result without the WHERE line, but I do need to filter the resultant data as that would imply. The error I’m getting is Invalid Column Name ‘FileCount’ after the WHERE keyword. I’ve been reading around and I can’t find…