Tag Archives: SQL Server

The Visual Studio component cache is out of date, Please restart Visual Studio – SSMS

By | June 14, 2020

This is not frequent error but yes we may face such error while connecting to ssms. The Visual Studio component cache is out of date, Please restart Visual Studio. Solution, clear temp files & run disk clean up for c drive. make sure you select temporary files. try reconnecting to ssms again, it will connect.

SQL Server UPDATE JOIN

By | November 28, 2019

UPDATE Table1 SET column1 = T2.column1, column2 = T2.column2 FROM #Table1 T2 JOIN #Table2 T2 ON T1.Column3 = T2.Column3 Lets say we have employee & ProjectTeam table as below respectively, Id Name Address PhoneNumber 11 Ajay Mumbai 887 12 Jatin Pune 356 ProjectId EmpId PhoneNumber P123 11   X234 12   So now we want… Read More »

How to check if a column exists in a SQL Server table

By | June 11, 2018

How to check if a column exists in a SQL Server table, Syntax: IF EXISTS(SELECT 1 FROM sys.columns WHERE Name = N’columnName’ AND Object_ID = Object_ID(N’schemaName.tableName’)) BEGIN — Column is exists in DB END Example: Let’s Check wether address column is present in Employee table or not. IF EXISTS(SELECT 1 FROM sys.columns WHERE Name =… Read More »

How to set a default value for an existing column in sql server

By | November 9, 2017

How to set a default value for an existing column in SQL server Syntax: ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL| NOT NULL} CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE} [WITH VALUES] For Example: ALTER TABLE EmployeeMaster ADD City NOT NULL CONSTRAINT EmpMaster_City DEFAULT ‘Pune’ Click here for more SQL Tutuorials