0

I am having trouble declaring a Table. By using the following code (SQL server)

DECLARE @dates TABLE date;

I get the error

SQL Error [103010] [S0001]: Parse error at line: 1, column: 16: Incorrect syntax near 'TABLE'.

Can someone explain what the problem might be?

FAHRB
  • 39
  • 1
  • 7

1 Answers1

1

The correct syntax requires table definition. Presumably something like:

declare @dates table (date date);

This declares a table with one column, whose name is date and whose type is date.

Here is a db<>fiddle.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786