![]() |
SQL error check
i was told to run this query
[sql]CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL, `alias` VARCHAR(50) NOT NULL ); [/sql] and I got [sql]Database error in vBulletin Control Panel 2.2.6: Invalid SQL: CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL, `alias` VARCHAR(50) NOT NULL ); mysql error: You have an error in your SQL syntax near '; ' at line 1 mysql error number: 1064[/sql] I was wondering if anyone could tell me what's wrong with the query or something, it would be of great help =) |
I think the DEFAULT clause must come after NOT NULL.
|
example? sorry, I am very illiterate :(
|
NOT NULL DEFAULT 0 rather than DEFAULT 0 NOT NULL.
|
ok i ran
[sql]CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0' , `alias` VARCHAR(50) NOT NULL ); [/sql] and got... [sql]Database error in vBulletin Control Panel 2.2.6: Invalid SQL: CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0' , `alias` VARCHAR(50) NOT NULL ); mysql error: You have an error in your SQL syntax near '; ' at line 1 mysql error number: 1064[/sql] |
You didn't specify a default for the second column (alias).
|
alright im really illiterate, please forgive me filburt1....least i'm not PMing you XD!
anyway... i ran... [sql]CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0' , `alias` VARCHAR(50) NOT NULL DEFAULT '0' ); [/sql] and got... [sql]Database error in vBulletin Control Panel 2.2.6: Invalid SQL: CREATE TABLE `useralias` ( `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0' , `alias` VARCHAR(50) NOT NULL DEFAULT '0' ); mysql error: You have an error in your SQL syntax near '; ' at line 1 mysql error number: 1064[/sql] *dies* also, i tried putting the DEFAULT 0 befor NOT NULL in both instances and still no luck :(:bunny: |
remove the ; at the end of the query
|
jeeze i am an idiot...thanks xenon :)
|
*gg*
you're welcome ;) |
All times are GMT. The time now is 01:10 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|