Link to home
Start Free TrialLog in
Avatar of Ann K
Ann K

asked on

Syntax Error in Query

Can you tell me where is the error?
User generated image
Avatar of _agx_
_agx_
Flag of United States of America image

First thing that jumps out is the use of curly brackets "{ }" instead of parenthesis, ie "( )"

CREATE TABLE Cart
(   <=== parenthesis
....
)  <=== parenthesis
Avatar of Ann K
Ann K

ASKER

what this error means:
User generated image
Same thing goes for the CONSTRAINT section:
CREATE TABLE Cart
(
[ID] INT IDENTITY(1,1) NOT NULL,
[ClientID] NVARCHAR(50) NOT NULL,
[ProductID] INT NOT NULL,
[Amount] INT NOT NULL,
[DatePurchased] DATETIME DEFAULT GETDATE(),
[IsInCart] BIT NOT NULL,
CONSTRAINT [PK_Purchase] PRIMARY KEY CLUSTERED([ID] ASC)
)

Open in new window

Curiousity overwhelms me ... Why would you ask a question like 'Where is the error?' without telling us what the syntax error is when executed?   Are we supposed to guess?

Clicking the Parse button (looks like a check) in the upper center of your screen will parse your query, and if when parsing it generates an error will display that error in the Results tab, lower center of your screen.  Parsing will compile your code without executing it.  Hitting the Execute button will also display errors, but also execute the command.

_agx_ is correct, rounded parents ( ) instead of squiggly parents { }.
Avatar of Ann K

ASKER

it shows the same error.
User generated image
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ann K

ASKER

Thank You.