Search
 
SCRIPT & CODE EXAMPLE
 

SQL

t-sql check if data exists

if exists(select 1 from INFORMATION_SCHEMA.TABLES T 
              where T.TABLE_NAME = 'Bookings') 
begin
    drop table Bookings
end
GO

create table Bookings(
  FlightID    int identity(1, 1) primary key,
  TicketsMax    int not null,
  TicketsBooked int not null
)
GO

insert  Bookings(TicketsMax, TicketsBooked) select 1, 0
insert  Bookings(TicketsMax, TicketsBooked) select 2, 2
insert  Bookings(TicketsMax, TicketsBooked) select 3, 1
GO

select * from Bookings
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle sql sort ascending 
Sql :: get triggers by query 
Sql :: sqlite insert if not exists 
Sql :: delete from inner join sql 
Sql :: sql server default port 
Sql :: for select oracle 
Sql :: sql select where 
Sql :: sql server management studio reset cache 
Sql :: drop all triggers oracle 
Sql :: Add colum sqlite table 
Sql :: oracle create tablespace autoextend 
Sql :: sql select all records from all tables where not empty 
Sql :: mysql create table index 
Sql :: mysql not empty 
Sql :: postgresql newline character 
Sql :: mysql in 
Sql :: update sql sintax 
Sql :: delete table row in postgresql 
Sql :: how covert into int in maria db 
Sql :: psql check if value in array 
Sql :: mysql delete from where like 
Sql :: postgresql where and 
Sql :: mysql switch case 
Sql :: how to relationship query two different tables in MySQL 
Sql :: sql table backup 
Sql :: date less than in sql 
Sql :: mysql generate create table script 
Sql :: date format in oracle 
Sql :: mysql query where in select 
Sql :: sql select like 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =