How to copy table structure only from a SQL Query ? Tip #69

 

Recently , one of my friends shared that some interviewer asked him a question “How to copy table structure only from a  SQL Query?”

So,

Below is simplest query to copy structure only of a table into another table.

SELECT *
Into #tmpStudentStructure
FROM tblStudentSource
WHERE 1= 0

in the above query we want to copy structure of tblStudentSource.

see below snap which help you to understand it more

table_Structure

I hope this might help you if some asked you this question.

Thanks & Enjoy!!!

RJ!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code