Advertisement
S_Madanska

temporary table

Nov 11th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.65 KB | None | 0 0
  1. create table #Temp
  2. (
  3.     EventID int,
  4.     EventTitle Varchar(50),
  5.     EventStartDate DateTime,
  6.     EventEndDate DatetIme,
  7.     EventEnumDays int,
  8.     EventStartTime Datetime,
  9.     EventEndTime DateTime,
  10.     EventRecurring Bit,
  11.     EventType int
  12. );
  13.  
  14. insert into #Temp
  15. values ( 1, 'DEV Fest', Getdate(), convert(datetime, '05-11-2019', 105), 2,  Getdate(), convert(datetime, '05-11-2019', 105), 0, 100);
  16.  
  17. select * from #Temp
  18.  
  19. create view ViewFromTemporaryTable
  20. as
  21. select EventID, EventTitle, EventStartTime
  22.   from #Temp;
  23.  
  24. -- Views or functions are not allowed on temporary tables. Table names that begin with '#' denote temporary tables.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement