MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old October 21st, 2003, 01:34 PM
caspyderman caspyderman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 caspyderman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Newbie: can't ALTER TABLE from asp page...

Hello,

I'm new to SQL 2000 and had a client give me just the username/password for the database, and the .asp files that are used to access it. They want me to add a couple of columns but when I had the .asp file send the following command to the server it responded with the error listed below.

var Command1 = Server.CreateObject("ADODB.Command");
Command1.ActiveConnection = MM_TESTCONN_STRING;
Command1.CommandText = "ALTER TABLE `REGISTRATION` ADD `EDUCATIONGPA1` WCHAR(50);";
Command1.CommandType = 4;
Command1.CommandTimeout = 0;
Command1.Prepared = true;
Command1.Execute();


The response was:
The Microsoft Jet database engine cannot find the input table or query 'ALTER'

I successfully used this connection to query before so, does this mean some permissions have been set to not allow a user to ALTER from an .asp file? I am new to db's as a whole and have always used some form of front-end for the mySQL work I've done in the past, but without access to the server and the application that allows me to do this, how else can I add a few columns to this DB?

any help is greatly appreciated, and if anyone is interrested in some random hourly project work for little things like this, throw your email on your response.

thanks in advance,
Brian

Reply With Quote
  #2  
Old October 21st, 2003, 10:38 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,442 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 h 50 m 36 sec
Reputation Power: 797
Yeah, it could be that the login they gave you doesn't have adequate permissions. However, the syntax of the statement is also incorrect. It should read something like this:
"ALTER TABLE REGISTRATION ADD EDUCATIONGPA1 CHAR(50)"
However, this brings up more questions here.

1. Why do you want to alter a table from an ASP page? Why not use the Query Analyser tool or the Enterprise manager to do this.

2. It is considered bad practice to use such a powerful account as one that alters table structures on an ASP page anyway. If someone manages to read the source code somehow, they have the password to a powerful account that could be used to drop tables as easily as creating columns.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month

Reply With Quote
  #3  
Old October 22nd, 2003, 11:45 AM
caspyderman caspyderman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 caspyderman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks,

I was trying to keep from needing to buy SQL Server for my desktop since I mostly develop in *NIX environments... but they have an evaluation version that I am downloading. That should make things easier for me now.

thanks again
Brian

Reply With Quote
  #4  
Old October 22nd, 2003, 12:28 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
From your post
Quote:
The Microsoft Jet database engine cannot ...

it seems you are using Access and not SQLServer, so I don't think that EnterpriseManager or QueryAnalyzer will help.
Also, those tools are available separately from the server engine, so no need to install the server on your pc

Reply With Quote
  #5  
Old March 26th, 2004, 07:06 AM
thepaulius thepaulius is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 thepaulius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face

H, im in the same boat kinda.. i need a create a new column each time a user hits submit witha new column name, but im at a loss as to hwo to do it! ive already got the code working to update a column with the date that a page was read, but no i have to allow somone else to create the columns (id usualy manually do it)

heres a rough idea as to what im going on about:

PHP Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> 
<!--
#include file="../Connections/imeche_procedures.asp" -->
<% 

    var 
Command1 Server.CreateObject("ADODB.Command");
    
Command1.ActiveConnection MM_imeche_procedures_STRING
    Command1
.CommandText "ALTER TABLE dbProcedure ADD Request.Form("proName") CHAR(50)"
    
Command1.CommandType 4
    Command1
.CommandTimeout 0
    Command1
.Prepared true
    Command1
.Execute(); 

%>
<
HTML>
<
HEAD>
<
TITLE>Untitled Document</TITLE>
<
META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</
HEAD>

<
BODY>
Enter Procedure Name 
<FORM NAME="CreateColumnForm" ID="CreateColumnForm">
  <
INPUT NAME="proName" TYPE="text" ID="proName">
  <
INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
</
FORM>
<
P></P>
</
BODY>
</
HTML


do i setthe form action the a subroutine - and wrap the SQL script in that subroutine?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Newbie: can't ALTER TABLE from asp page...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway