Skip to main content

Posts

Showing posts with the label delete table

Table data Backup steps from database in SQL Management Studio

How You  can take table backup in sql database There is simple way and step shown in below youtube clip. 1.Open SQL database engine and connect it. 2.let us You want to copy data of table custtable to  table custtable_bkp where custtable_bkp does not exist in your database. 3. This clip will show the step and will create new table with data of custtable . 4. In this clip select into statement used same way you can do the same using insert into command also but insert into used if table custtable_bkp already exist with structure only not data. 5. If you want to drop or delete table you can use this command. drop table <table name> Mow after execution  drop command table will be deleted.. Thanks for watching. If you like it please subscribe

SQL Stored Procedure Examples-Create,Delete and Drop Table ,insert,row count

Create,Delete and Drop Table  Through SQL Stored Procedure Following is code which you can create new Stored procedure in SQL Stored procedure section and can write following code. You can understand easily by reviewing whole code. set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO Create PROCEDURE [dbo].[SP_abc](@userID char(3)) AS BEGIN -- Statement to create table if NOT exists (select * from dbo.sysobjects where id = object_id('abc')) exec("CREATE TABLE abc(@field1 CHAR(3),LOGDT SMALLDATETIME,LOGTM DATETIME )") END set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO -- Statement to Delete records from table table Create PROCEDURE [dbo].[SP_DELETE](@ID1 char(3)) AS BEGIN SET NOCOUNT ON if exists (select * from dbo.sysobjects where id = object_id('L')) BEGIN DELETE FROM abc WHERE ID1=@id1 END END set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO -- Statement to Drop table Create PROCEDUR