Wednesday 15 August 2012

sql - Syntax Error on Really Simple IF x CREATE TABLE statement -



sql - Syntax Error on Really Simple IF x CREATE TABLE statement -

i'm writing tic tac toe game in sql server 2008. have far:

print ' ========================================================== tic tac toe - sql server 2008 - name - 10/30/2014 ========================================================== insert ''x'', type exec pmakemove row, column, skip. row , column must both between 1 , 3 or automatically forfeit move. skip can either 1 or 0, 1 specifying you''d skip turn. start first, unless decide skip first turn. ''x'' , pc ''o''. when create move, pc automatically create move well, game check winner after each of these moves. after each move, game board displayed. on winning move, game board displayed, message displayed, , board cleared. ' if not exists ( select * information_schema.tables table_schema = 'dbo' , table_name = 'tictactoe') begin create table tictactoe ( [row] int, [1] bit, [2] bit, [3] bit ) insert tictactoe (row,[1],[2],[3]) values (1,null,null,null),(2,null,null,null),(3,null,null,null) end else begin update tictactoe set [1]=null,[2]=null,[3]=null end

and random error i'm getting:

msg 102, level 15, state 1, line 31 wrong syntax near ')'.

i don't see obvious reason this.

it's forcing me add together more details. that's details need. stackoverflow stupid sometimes.

change statement this:

create table tictactoe ( row int, [1] bit, [2] bit, [3] bit )

when defining table can't write as. it's relatively mutual error , parser isn't helpful it.

sql sql-server tsql

No comments:

Post a Comment