Today I just got went though this, this helps you to execute a string in SQL. This is how you can execute a string in SQL, Declare @query Varchar(500) Set @query = ‘Select * From Employees’ Exec (@query) OR EXEC (‘USE AdventureWorks; SELECT EmployeeID, Title FROM HumanResources.Employee;’) This way you can execute a string in [...]
Archive for the ‘MS SQL’ Category
SQL Execute with character string
Posted in MS SQL, Technology, tagged EXEC, SQL, SQL 2005, SQL Exec, SQL Execute, String Execute, TSQL on July 6, 2009 | 2 Comments »
Copy table schema using SQL query
Posted in MS SQL, Technology, tagged copy table structure, Select INTO, Select query, SQL, SQL 2005 on July 2, 2009 | 1 Comment »
How will you copy table structure using an SQL Query? This was the question I was asked in one of the inteview, after hearing this I first thought, Is there a way to copy only the table structure. I only knew the query to copy data along with its structure and take backup of tables.And [...]
