Advertisement

09.01.2004 at 09:28AM PDT, ID: 21115503
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

Stored Procedures With a TimeStamp Column

Asked by jturkington in ColdFusion Application Server

Tags: , , ,

Having Problems Inserting Details into a SQL Server 2000 database

Coldfusion Code to do this is :-
<cfstoredproc procedure="AddCand" datasource="IntranetBeta">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="Title" value="Mr" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="FirstName" value="Jonathan" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="MiddleName" value="David" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="LastName" value="smith" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="JobTitle" value="IT Manager" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="Address" value="12 High Street" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="TownCity" value="Belfast" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="Country" value="Scotland" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="PostCode" value="FK2 0JW" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="HomeNo" value="565654656" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="MobileNo" value="04458385867" null="No">          
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="WorkNo" value="0349 4958675" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="EmergencyNo" value="0384 63948576" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_TINYINT" dbvarname="NoticePeriod" value="4" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="MaritalStatus" value="Single" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="Email" value="Jonathan@jarvisking.com" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_DATETIME" dbvarname="DOB" value="10/11/1977" null="NO">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="Gender" value="Male" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" dbvarname="Status" value="Available" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" dbvarname="SalaryFrom" value="20000" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" dbvarname="SalaryTo" value="30000" null="No">
<cfprocparam type="In" cfsqltype="CF_SQL_DateTime" dbvarname="RegDate" value="" null="Yes">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="LastUpdatedUser" value="#getauthuser()#" null="No">
<cfprocparam type="In" cfsqltype="cf_sql_timestamp" dbvarname="TimeStamp" value="" null="Yes">
</cfstoredproc>

Error Received

[Macromedia][SQLServer JDBC Driver][SQLServer]Implicit conversion from data type datetime to timestamp is not allowed. Use the CONVERT function to run this query

Stored Procedure in SQL:  -

Use IntranetBeta

GO
ALTER PROC AddCand
      @Title                  char(10) = NULL,
      @FirstName            varchar(100),
      @MiddleName            varchar(100) = NULL,
      @LastName            varchar(100),
      @JobTitle                            varchar(100) = NULL,
      @Address                            varchar(100),
      @TownCity            varchar(100),
      @Country                            varchar(100) = NULL,
      @PostCode            char(10) = NULL,
      @HomeNo                  char(15) = NULL,
      @MobileNo            char(15) = NULL,
      @WorkNo                  char(15) = NULL,
      @EmergencyNo            char(15) = NULL,
      @NoticePeriod            tinyint,
      @MaritalStatus            varchar(20) = NULL,
      @Email                  varchar(100) = NULL,
      @DOB                  smalldatetime = NULL,
      @Gender                  char(6),
      @Status                  char(11),
      @SalaryFrom            int = NULL,
      @SalaryTo                            int = NULL,
      @RegDate                            datetime = NULL,
      @LastUpdatedUser                      varchar(50),
      @TimeStamp            timeStamp
AS
      /* Set RegDate To DateTime as no parameter being passed in from CF */
      If @Regdate Is Null
                Set @RegDate = getdate()

      /* Create the new Record */
      INSERT INTO Candidates
      VALUES
         (
            @Title,
            @FirstName,
            @MiddleName,
            @LastName,
            @JobTitle,
            @Address,
            @TownCity,
            @Country,
            @PostCode,      
            @HomeNo,
            @MobileNo,
            @WorkNo,
            @EmergencyNo,
            @NoticePeriod,
            @MaritalStatus,
            @Email,
            @DOB,
            @Gender,
            @Status,
            @SalaryFrom,
            @SalaryTo,
            @RegDate,
            @LastUpdatedUser,
            @TimeStamp
          )

Also is there any smart way of skipping fields for input into the database or do you have to specify every column in order when create a stored procedure and give it null etc.. ??,

From the above code you can see that I want SQL to do the timestamping for regdate by using GETDATE() but how do you do it with a TIMESTAMP data type without passing anything from the Coldfusion side ??

Thanks for your Help

500 Points for Grabs

Jonny
Start Free Trial
[+][-]09.01.2004 at 09:33AM PDT, ID: 11954687

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:34AM PDT, ID: 11954693

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:38AM PDT, ID: 11954755

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:41AM PDT, ID: 11954814

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:42AM PDT, ID: 11954831

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:46AM PDT, ID: 11954892

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:46AM PDT, ID: 11954893

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:51AM PDT, ID: 11954980

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 09:58AM PDT, ID: 11955096

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 10:02AM PDT, ID: 11955145

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.01.2004 at 10:08AM PDT, ID: 11955231

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: ColdFusion Application Server
Tags: conversion, from, implicit, timestamp
Sign Up Now!
Solution Provided By: mrichmon
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.01.2004 at 12:30PM PDT, ID: 11957046

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32