
sql server - How do I perform an IF...THEN in an SQL SELECT?
Sep 15, 2008 · The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server. SELECT CAST( CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 …
How to implement LIMIT with SQL Server? - Stack Overflow
I have this query with MySQL: select * from table1 LIMIT 10,20 How can I do this with SQL Server?
Format SQL in SQL Server Management Studio - Stack Overflow
Feb 13, 2020 · Beginning with SQL Server Management Studio (SSMS) 18.7, Azure Data Studio is automatically installed alongside SSMS. Source Update: Actually Azure Data Studio is in …
How to connect to a local database in SQL Server Management …
Apr 6, 2017 · 96 I have downloaded the SQL Server Management Studio (SSMS) 2016 to recover a huge .bak file which is an old backup of a database. But first of all I need to connect to a DB …
How to connect to SQL Server from command prompt with …
Mar 21, 2014 · How can I connect to SQL Server from command prompt using Windows authentication? This command Sqlcmd -u username -p password assumes a username & …
SQL - Query to get server's IP address - Stack Overflow
Sep 26, 2008 · Is there a query in SQL Server 2005 I can use to get the server's IP or name?
sql server - Simple way to transpose columns and rows in SQL?
How do I simply switch columns with rows in SQL? Is there any simple command to transpose? ie turn this result: Paul | John | Tim | Eric Red 1 5 1 3 Green 8 ...
Create Local SQL Server database - Stack Overflow
Apr 11, 2017 · After installation you need to connect to Server Name : localhost to start using the local instance of SQL Server. Once you are connected to the local instance, right click on …
How to send email from SQL Server? - Stack Overflow
Nov 9, 2012 · How can I send an email using T-SQL but email address is stored in a table? I want to loop through the table and be able to send email. I cannot find a good example of doing this …
How do you list the primary key of a SQL Server table?
Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.