My app is throwing an exception on an “after update” trigger in the database when the following query is run against a record that contains an email address that already exists on another user. In other words, the record hasn’t been updated, but should have been ignored because of the EXISTS…
Tag: sql-server
How can I refactor the below code to make it faster?
This code is developed by my colleague, and it is really slow. I don’t want to create any temp table. How can I make this query faster? Answer
Remove Identity Setting from all Tables which have Identity
Using SQL Server, to remove the is identity setting (auto increment) for a table, I have to drop and recreate a table. Is there a way to disable the Idendity Setting for all tables with a simple …
Access – Change fields in table automatically, if a field changes
Lets say I got a table with an id, pre- and lastname. I made them work as comboboxes in the table. Now if I change 1 field (lets say the id) with the combobox I want that all the other stuff is …
Get encrypted column name with their encryption key and certificate in sql server
I am using SQL Server 2008/2012.In my database I have a table which has encrypted column. The column is encrypted by using following query – Create the example table CREATE TABLE [HR].[Employees]( …
Can we write case statement without having else statement
I have this query: It is giving me o/p as Id A B NULL NULL NULL I don’t want to have NULL values in my output, I only want to compare in A and B, is it possible in case statement. Answer A case expression can only manipulate the value of an expression, not remove rows from the result. If
import from excel to sql server: The ‘Microsoft.ACE.OLEDB.12.0’ provider error
I want to import data from excel to sql server, but I got error: The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine. op: windows 10 64 bit excel: 32 bit There is no …
what is the difference between Coalesce and nullif
I am currently working on an SSRS report that will need to display a Dr’s ID based on either their DEA number or NPI number. I need to be able to do a coalesce on DEA and NPI to find the non-unknown one, which I will then add code to the SSRS report that will display a hover over stating
Select all from one table where some columns match another select
I have two differents tables. The have some columns in common, for this example lets say ‘name’ and ‘id’. By making ( SELECT name,id FROM table1 EXCEPT SELECT name,id FROM table2) UNION …
how to select multiple rows using where (two conditions) in sql?
When the condition is based on one column, I can use either IN, AND, or OR, but if the condition is based on two columns, how to write the query? For example, I need to set up the value of column 1 to NULL in the following rows: column 2 = ‘red’ AND column 3 =’ Monday’, column 2 =