Ok this is difficult to phrase, so here goes… I am using MS SQL Server 2008 R2. I have a temp table that lets say has two already populated columns. There is a third empty column I want to populate based on the value of the first two columns. What I want to do is create a guid (using NEWUID())
Tag: sql-server-2008
How do I find duplicates across multiple columns?
So I want to do something like this sql code below: To produce the following, (but ignore where only name or only city match, it has to be on both columns): Answer Duplicated id for pairs name and city:
SQL Server – Return value after INSERT
I’m trying to get a the key-value back after an INSERT-statement. Example: I’ve got a table with the attributes name and id. id is a generated value. INSERT INTO table (name) VALUES(‘bob’); …
How to perform a LEFT JOIN in SQL Server between two SELECT statements?
I have two SELECT statements in SQL Server like these: I want to perform a LEFT JOIN between these two SELECT statements on [UserID] attribute and [TailUser] attribute. I want to join existent records in second query with the corresponding records in first query and NULL value for absent records. How can I do this? Answer
How do I import a sql data file into SQL Server?
I have a .sql file and I am trying to import it into SQL Server 2008. What is the proper way to do this? Answer If you are talking about an actual database (an mdf file) you would Attach it .sql files are typically run using SQL Server Management Studio. They are basically saved SQL statements, so could be anything.
How to Troubleshoot Intermittent SQL Timeout Errors
We’ve been having a few instances per day where we get a slew of SQL Timeout errors from multiple applications (System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.) We have over 100 different applications on our network, both web and desktop apps. Everything from VB6 and Classic ASP to
Bulk load data conversion error (truncation)
I am getting this error Bulk load data conversion error (truncation) for row 1, column 12 (is_download) here is the csv…it only has one row 30,Bill,Worthy,sales,,709888499,bat@bat.com,,”Im a a …
Create SQL INSERT Script with values gathered from table
I need to create a INSERT script in order to insert in another database the same data. If in SQL Server I select “Script table as > INSERT To” I can easily recreate the skeleton for the INSERT …
Average of multiple columns
I have a table called Request and the data looks like: Req_ID R1 R2 R3 R4 R5 R12673 2 5 3 7 10 R34721 3 5 2 1 8 R27835 1 3 8 5 6 Now I want …
SQL Server Stored Procedure to Send Email
This is my first attempt at writing a stored procedure that emails someone. When trying to execute I get these errors: The code that I am using which is causing this is: Answer You’re missing a comma after the @body line, which is throwing off your declarations. Add it here: