vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   SQL error check (https://vborg.vbsupport.ru/showthread.php?t=52774)

Hobbes 05-10-2003 11:17 PM

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 =)

filburt1 05-10-2003 11:22 PM

I think the DEFAULT clause must come after NOT NULL.

Hobbes 05-10-2003 11:26 PM

example? sorry, I am very illiterate :(

filburt1 05-10-2003 11:35 PM

NOT NULL DEFAULT 0 rather than DEFAULT 0 NOT NULL.

Hobbes 05-10-2003 11:42 PM

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]

filburt1 05-10-2003 11:48 PM

You didn't specify a default for the second column (alias).

Hobbes 05-10-2003 11:55 PM

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:

Xenon 05-11-2003 10:39 AM

remove the ; at the end of the query

Hobbes 05-11-2003 06:42 PM

jeeze i am an idiot...thanks xenon :)

Xenon 05-11-2003 06:43 PM

*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
  • Page Generation 0.00962 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete