SunQuest
 
           Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 9th, 2002, 08:03 AM
AJPeck AJPeck is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 1 AJPeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Stored procedure in SQL2000

I'm trying to use PHP to execute a stored procedure on SQL Server 2000 - I'm only trying to insert data in the two fields that comprise a single table (starting small!):

My table is called MeetMinutes and is defined as:
NameOfFile VARCHAR
MeetDate SMALLDATETIME

Because PHP doesn't have a DATE type, I'm using SQLVARCHAR in both mssql_bind statements.

My php fragment:
PHP Code:
 $Init=MSSQL_INIT("UpdateMinutes",$Link)
    or die(
"Couldn't initialise the procedure");
      
  
MSSQL_BIND($Init,"@Filename",$Filename,SQLVARCHAR,FALSE,FALSE,50)
   or die(
"Could not send the name of the file to the procedure");

 
MSSQL_BIND($Init,"@MeetDate",$MeetingDate,SQLVARCHAR,FALSE,FALSE,10)
    or die(
"Could not send the date of the meeting to the procedure");
    
  
$Done=MSSQL_EXECUTE($Init)
        or die(
"Couldn't update the database"); 

I keep getting the final "Couldn't update the database" message - I've tried running the procedure in SQL and it's having trouble converting from a VARCHAR to a date/time. I've tried all manner of CAST/CONVERT functions but with no success.

The stored proc. is (latest version!):

CREATE PROCEDURE UpdateMinutes
@Filename VARCHAR (50),
@MeetDate VARCHAR (10) --I assume this has to match the PHP
AS
INSERT INTO MeetMinutes (NameOfFile,MeetingDate)
VALUES ('@Filename',CAST ('@MeetDate' AS SMALLDATETIME))
GO

It's probably something fairly basic as I'm very new to this - any help gratefully received.

Last edited by AJPeck : December 9th, 2002 at 09:25 AM.

Reply With Quote
  #2  
Old January 15th, 2003, 04:38 PM
strobe74 strobe74 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 4 strobe74 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Didn't see this post untill after i posted my example. Look here for a quick example of running a SP on a MSSQL server with PHP.

Hope it helps.

URL

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Stored procedure in SQL2000


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 4 hosted by Hostway