Tags » SQL Server

SQL SERVER - Error: Msg 245 - Conversion failed when converting the varchar value 'Inactive' to data type int

Using CASE statements is something I see a lot of developers use. They use it in complex environments and I have been fortunate to troubleshoot and look at code blocks that run for pages using the standard CASE statements. 369 more words

SQL Authority

What is the difference between Temp Table and Table Variable?

Temp table and Table Variable both are created in TempDB and not in Memory

Syntax for creating Temp Table is exactly same as creating Physical Table… 326 more words

Sql Server

What is the CTE in sql server ?

1. CTE is the common table expression. This feature comes in sql server 2005 onward.
2. It is the temporary result set and generally it will be the result set of complex Sub Query. 151 more words

Sql Server

T-SQL query to get the number of columns in a table

SELECT COUNT(COLUMN_NAME) 
FROM [ this_is_my_database_name].INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_CATALOG = ' this_is_my_database_name' 
AND TABLE_SCHEMA = 'dbo' --this is dbo by default, change if you need
AND TABLE_NAME = 'this_is_my_table_name'

SQL Server

SQL Server Tips: convert multiple rows to single row csv

Sometimes we would need data display in single value as csv (comma separated values) rather than rows, i.e.

--select COLUMN_NAME from TABLE_NAME
pizza…
40 more words

SQL Server

SQL Server Tips: Random return single row data on every execution

Hi all, hope this simple code could help you on project :)


SELECT TOP 1 *
FROM TABLE_NAME
ORDER BY NEWID()  --add this line

SQL Server

SQL SERVER - Free SQL Complete Add-in For SSMS

This article covers main features of ApexSQL Complete, free SQL complete add-in. You can download the most recent version, and check its features while reading the article. 927 more words

SQL Authority