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…
Tag: sql-server
Extract last day of the month from MMM(M)YYYY
How can I extract the last day of the month from dates like DEC2009, APR2013, AUG2008, NOV2017, JUL2014 etc. I’ve tried datepart, convert, cast, month, year and I keep getting in a mess with type conversion errors. Answer Use try_convert and eomonth()
Table get locked when called an SQL Server SP from pyodbc Python [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 months ago. Improve this question Table get locked when called an SQL Server SP from pyodbc Python I have a table I made for …
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…
How can I insert into from one table to another with autoincrement in SQL Server
If for example I have these 2 tables in SQL Server: What I am trying to do is to insert the entries from table 1 to table 2, but I want table 2 to autoincrement the Number. So I want it to become like this : I tried queries like this but it didn’t work: Maybe you will suggest to
How to find login name in SQL Server from a user_name of database
How can I find login name in SQL Server from a user_name of database using a stored procedure? Answer For example you can use the system functions
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…