LoslegenKostenlos starten

DECLARE a TABLE

Let's create a TABLE variable to store Shift data and then populate it with static values.

Diese Übung ist Teil des Kurses

<Kurs>Writing Functions and Stored Procedures in SQL Server</Kurs>
Kurs ansehen

Übungsanweisungen

  • Use DECLARE to create a TABLE variable named @Shifts
  • The @Shifts table variable should have the following columns - StartDateTime and EndDateTime - both of datetime data type.
  • Populate the table variable with the values '3/1/2018 8:00 AM' and '3/1/2018 4:00 PM'.

Interaktive praktische Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

-- Declare @Shifts as a TABLE
___ ___ ___(
    -- Create StartDateTime column
	___ ___,
    -- Create EndDateTime column
	___ ___)
-- Populate @Shifts
___ ___ ___ (StartDateTime, EndDateTime)
	SELECT '3/1/2018 8:00 AM', '3/1/2018 4:00 PM'
SELECT * 
FROM @Shifts
Code bearbeiten und ausführen