Global web icon
stackoverflow.com
https://stackoverflow.com/questions/1641718/how-to…
How to select unique records by SQL - Stack Overflow
How to select unique records by SQL Asked 16 years, 1 month ago Modified 1 year, 11 months ago Viewed 747k times
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/520967/databas…
sql server - Database stuck in "Restoring" state - Stack Overflow
Ran into a similar issue while restoring the database using SQL server management studio and it got stuck into restoring mode. After several hours of issue tracking, the following query worked for me.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/729197/exclude…
sql - Exclude a column using SELECT * [except columnA] FROM tableA ...
We all know that to select all columns from a table, we can use SELECT * FROM tableA Is there a way to exclude column(s) from a table without specifying all the columns? SELECT * [except columnA]...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/4862385/sql-se…
SQL Server add auto increment primary key to existing table
7 This answer is a small addition to the highest voted answer and works for SQL Server. The question requested an auto increment primary key, the current answer does add the primary key, but it is not flagged as auto-increment. The script below checks for the columns, existence, and adds it with the autoincrement flag enabled.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/334108/how-do-…
How do I check if a Sql server string is null or empty
Select Coalesce(listing.OfferText, company.OfferText, '') As Offer_Text, from tbl_directorylisting listing Inner Join tbl_companymaster company On listing.company_id= company.company_id But I want to get company.OfferTex t if listing.Offertext is an empty string, as well as if it's null. What's the best performing solution?
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/44046/truncate…
Truncate (not round) decimal places in SQL Server
I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding. For example: declare @value decimal(18,2) set @value = 123.456 This will automatically round @
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/1293330/how-ca…
How can I do an UPDATE statement with JOIN in SQL Server?
This was an example, but the point is as Eric said in How can I do an UPDATE statement with JOIN in SQL Server?. You need to add an UPDATE statement at first with the full address of all tables to join with, and then add the SET statement.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/6388756/sql-se…
SQL Server String or binary data would be truncated
SQL Server 2017 CU12 also supports this feature. Improvement: Optional replacement for "String or binary data would be truncated" message with extended information in SQL Server 2017 This SQL Server 2017 update introduces an optional message that contains the following additional context information.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/1520789/how-ca…
How can I select the first day of a month in SQL?
I used GETDATE () as a date to work with, you can replace it with the date which you need. Here's how this works: First we format the date in YYYYMMDD... format truncating to keep just the 6 leftmost characters in order to keep just the YYYYMM portion, and then append '01' as the month - and voila! you have the first day of the current month.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/19730441/incor…
sql - Incorrect syntax near '' - Stack Overflow
SELECT TOP 1000 * FROM master.sys.procedures as procs left join master.sys.parameters as params on procs.object_id = params.object_id This seems totally correct, but I keep getting the following error: Msg 102, Level 15, State 1, Line 6 Incorrect syntax near ''. It works if I take out the join and only do a simple select: