New Posts  All Forums:Forum Nav:

SQL Help Please

post #1 of 14
Thread Starter 
Can any one tell me why SQL is saying invalid column name. . . I'm simply trying to add a NOT NULL CONSTRAINT


 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #2 of 14
Thread Starter 
illegal bump because if this is wrong then I have to change many other lines of code before moving on to indexes, sequences, etc. . . and its due tomorrow. . I have it written out but not compiled. . ..
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #3 of 14
I don't know anything about constraints, but your sql query looks a little strange. Something like this?
Code:
ALTER TABLE Parents
 2 ADD CONSTRAINT First_Guard_Last_nn NOT NULL (First_Guard_Last),
 ADD CONSTRAINT First_Guard_Last_nn NOT NULL (First_Guard_Last);
What's with the "2"?

Edit: Actually I'm not quite sure even that would be right, syntax-wise.
post #4 of 14
Thread Starter 
The second one is added when there is an error. . it repeats the erroneous code.
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #5 of 14
I *think* you can do:

ALTER TABLE Parents ADD CONSTRAINT First_Guard_Last_nn SET NOT NULL

I don't think you need the parens because you aren't doing a multiple column constraint.
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #6 of 14
Thread Starter 
Ill try as soon as I can reconnect to the Terminal . .

and since I cant rep a mod Ill give you one of these:
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #7 of 14
Are you using mySQL? I'm only familiar with MS SQL Server so take what I say with a grain of salt.

Try using square brackets around your column name like this: [First_Guard_Last] - or fully qualify it like this [Parents].[First_Guard_Last]

Also, since I'm not familiar with mySQL, I did some googling for you and came across this (see the synatx under section 3.1) - http://sql-info.de/en/mysql/referential-integrity.html

and this: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

Are you sure your synatx is right?

From what I read in the 2nd link, it seems to me that your syntax should be:

ALTER TABLE parents MODIFY First_Guard_Last varchar2(15) not null

Toward the end of that 2nd link, there are a bunch of forum posts. One says:
Quote:
You can't drop a NOT NULL constraint on a column the way you can a foreign key or an index, or a default. Instead, just use the 'change' or 'modify' syntax and leave off the NOT NULL bit:

alter table table_name modify col_name bigint default null;

Any pre-existing indexes or foreign keys on the column are not affected.
Hope that helps!
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
Reply
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
Reply
post #8 of 14
Thread Starter 
I modeled my syntax right from my book . . and Im using SQLPlus and have to so I cant use another compiler. . . thanks for the links Ill take a look at them.
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
post #9 of 14
Ok, I assumed incorrectly that the output was from mySQL (the mySQL editor looks a lot like SQLPlus).

From this link: http://www.princeton.edu/~storacle/s...tutorial.shtml

Quote:
You can specify a new constraint on an existing table via the alter table command. The following example defines a new not null constraint on the table test_table

describe test_table;
alter table test_table modify (
full_name varchar2(64) constraint nn_test_fullname not null);
describe test_table;
Looks like you need the word "modify" in there. And it looks like the table name comes before the constraint name.

Hope that is more helpful.
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
Reply
     
CPUMotherboardGraphicsRAM
Q9450 @ 3.0 Gigabyte GA-P45-UD3P Evga 9800GTX+ 800/1943/1200 2x2GB OCZ 1066 LV 
Hard DriveOptical DriveOSMonitor
Vertex 2 40gb + 750gb Seagate 7200.10 Lite-On 24x DVD+-RW Windows 7 x64 LG 22" 1680x1050 
PowerCase
Corsair HX520w modular Coolermaster CM-690 
CPUMotherboardRAMHard Drive
Sempron LE-1250 Gigabyte GA-MA78GPM-DS2H 2GB (2x1GB) Corsair Ballistix 1066 2x750GB Western Digital RE2 Green power 
OSPowerCase
Windows Home Server w/ PP3 Ultra 400w modular Antec 300 
  hide details  
Reply
post #10 of 14
Thread Starter 
damn . . ive never seen that format before. . . hmm . . of course remote desktop doesnt work well over wireless too :-/ . . Ill check tomorrow I guess
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
 
ESXi Server
(10 items)
 
HTPC
(13 items)
 
CPUMotherboardGraphicsRAM
i7-4790K Asus Sabertooth Mark 2 Radeon HD 6950 GSkill Sniper Series 
Hard DriveCoolingOSMonitor
Samsung XP941 Noctura NH-D14 8.1 Pro QNIX 27", Dell 24", Samsung 22", Sony 24" 
KeyboardPowerCaseMouse
Corsair K95 PC&P 750 NZXT H2 Logitech G500s 
CPUHard DriveHard DriveHard Drive
Phenom II x4 965 WE Red Seagate Intel SSD 
Hard DriveCoolingOSOS
WR Raptor  Silenx Fans x2 120mm Win 7 x2 Unraid 
OSCase
pfsense Rackmount 16 bay hot-swap 
CPUMotherboardGraphicsRAM
i3 2100t Gigabyte integrated 2x 8GB GSkill 
Hard DriveCoolingOSMonitor
OCZ SSD Stock Win7 - Plex Shell Sony XBR2 
PowerCase
Generic 350 watt Repurposed Vidabox 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming