473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with stored proc.

{System.Data.SqlClient.SqlException: Incorrect syntax near 't'.
Must declare the scalar variable "@ProjectQuestionId".
Unclosed quotation mark after the character string ''.
Must declare the scalar variable "@ProjectCodeId".
Incorrect syntax near 't'.
Must declare the scalar variable "@ProjectQuestionNo".

USE [RG10_Study]

GO

/****** Object: StoredProcedure [dbo].[Rg_sp_CreateProjectProcedures] Script Date: 10/02/2006 11:44:42 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO





/************************************************** ******************************

Creation Date Sept. 20, 2006

By Mathieu Cupryk

Mod Date

By

Parameters @nvcDwName Input Full datawarehouse name i-f null exits

Returns nothing

Description Create tables in database RG10 which was just created by

RG10_sp_CreateProjectDatabase

************************************************** ********************************/





CREATE procedure [dbo].[Rg_sp_CreateProjectProcedures] @nvcDatabaseName nvarchar(255)

as

DECLARE @SQL NVARCHAR(4000)

SET @SQL = N'EXECUTE ' + @nvcDatabaseName + N'.dbo.sp_executesql N''

CREATE PROCEDURE [dbo].[AddProjectQuestionContentFrequency]

AS

SET NOCOUNT ON

INSERT INTO [ProjectQuestionContentFrequency] (

ProjectQuestionId,

ProjectQuestionContent,

ProjectQuestionContentFrequency,

ProjectQuestionContentDateTime)

SELECT

ProjectQuestionId,

ProjectResponseContent,

count (*) ,

GETDATE()

from ProjectResponse

group by ProjectQuestionId, ProjectResponseContent'''

EXECUTE (@SQL)


DECLARE @SQL1 NVARCHAR(4000)

SET @SQL1 = N'EXECUTE ' + @nvcDatabaseName + N'.dbo.sp_executesql N''

CREATE PROCEDURE [dbo].[AddProjectQuestionIdFrequency]

AS

SET NOCOUNT ON

INSERT INTO [ProjectQuestionIdFrequency] (

ProjectQuestionId,

ProjectQuestionFrequency,

ProjectQuestionIdDateTime)

SELECT

ProjectQuestionId,

count (*) ,

GETDATE()

from ProjectResponse

group by ProjectQuestionId'''

EXECUTE (@SQL1)

DECLARE @SQL2 NVARCHAR(4000)

SET @SQL2 = N'EXECUTE ' + @nvcDatabaseName + N'.dbo.sp_executesql N''

CREATE Procedure [dbo].[prAddProjectCode]

@ProjectQuestionId int,

@ProjectCode nvarchar(255),

@ProjectCodeLabelId int,

@ProjectCodeIsOpen bit,

@ProjectCodeIsActive bit,

@ProjectCodeId int OUTPUT

AS

-- Improve performance - don''t report number of rows

SET NOCOUNT ON

INSERT INTO [ProjectCode] (

ProjectQuestionId,

ProjectCode,

ProjectCodeLabelId,

ProjectCodeIsOpen,

ProjectCodeIsActive)

VALUES (

@ProjectQuestionId,

@ProjectCode,

@ProjectCodeLabelId,

@ProjectCodeIsOpen,

@ProjectCodeIsActive)

SELECT @ProjectCodeId = SCOPE_IDENTITY()

'''

EXECUTE (@SQL2)

DECLARE @SQL3 NVARCHAR(4000)

SET @SQL3 = N'EXECUTE ' + @nvcDatabaseName + N'.dbo.sp_executesql N''

CREATE Procedure [dbo].[prAddProjectQuestion]

(

@ProjectQuestionNo int,

@ProjectQuestionType nvarchar(255),

@ProjectQuestionName nvarchar(255),

@ProjectQuestionLastModifiedDate datetime,

@ProjectQuestionDateFormat nvarchar(255),

@ProjectQuestionShortLabelId int,

@ProjectQuestionLongLabelId int,

@ProjectQuestionMessageId int,

@ProjectQuestionMinAnswer tinyint,

@ProjectQuestionMaxAnswer tinyint,

@ProjectQuestionCodeWidth int,

@ProjectQuestionHasOpenEnd bit,

@ProjectQuestionLBoundary nvarchar(255),

@ProjectQuestionUBounday nvarchar(255),

@ProjectQuestionMaxtrixNo int,

@ProjectQuestionMatrixLength int,

@ProjectQuestionIsActive bit,

@ProjectQuestionIsCalculated bit,

@ProjectQuestionId int OUTPUT

)

AS

-- Improve performance - don''t report number of rows

SET NOCOUNT ON

INSERT INTO dbo.ProjectQuestion

([ProjectQuestionNo]

,[ProjectQuestionType]

,[ProjectQuestionName]

,[ProjectQuestionLastModifiedDate]

,[ProjectQuestionDateFormat]

,[ProjectQuestionShortLabelId]

,[ProjectQuestionLongLabelId]

,[ProjectQuestionMessageId]

,[ProjectQuestionMinAnswer]

,[ProjectQuestionMaxAnswer]

,[ProjectQuestionCodeWidth]

,[ProjectQuestionHasOpenEnd]

,[ProjectQuestionLBoundary]

,[ProjectQuestionUBounday]

,[ProjectQuestionMaxtrixNo]

,[ProjectQuestionMatrixLength]

,[ProjectQuestionIsActive]

,[ProjectQuestionIsCalculated])

VALUES

(

@ProjectQuestionNo,

@ProjectQuestionType,

@ProjectQuestionName,

@ProjectQuestionLastModifiedDate,

@ProjectQuestionDateFormat,

@ProjectQuestionShortLabelId,

@ProjectQuestionLongLabelId,

@ProjectQuestionMessageId,

@ProjectQuestionMinAnswer,

@ProjectQuestionMaxAnswer,

@ProjectQuestionCodeWidth,

@ProjectQuestionHasOpenEnd,

@ProjectQuestionLBoundary,

@ProjectQuestionUBounday,

@ProjectQuestionMaxtrixNo,

@ProjectQuestionMatrixLength,

@ProjectQuestionIsActive,

@ProjectQuestionIsCalculated

)



SELECT @ProjectQuestionId = SCOPE_IDENTITY()

'''

EXECUTE (@SQL3)

DECLARE @SQL4 NVARCHAR(4000)

SET @SQL4 = N'EXECUTE ' + @nvcDatabaseName + N'.dbo.sp_executesql N''

CREATE Procedure [dbo].[prAddProjectResponseandRespondent]

--- five inputs

@ProjectRespondentVcId nvarchar(255), --- this is used for first insert

@ProjectRespondentCompletionDate datetime, --- this is used for first insert

@ProjectQuestionId int,

@ProjectResponseMention int , --- this is used for second insert

@ProjectResponseContent nvarchar(255) , --- this is used for second insert

@ProjectResponseOpenEndContent ntext --- this is used for second insert

AS

BEGIN

declare @ProjectRespondentId int

SET NOCOUNT ON

BEGIN TRAN

INSERT INTO [ProjectRespondent] (

ProjectRespondentVcId,

ProjectRespondentCompletionDate)

VALUES (

@ProjectRespondentVcId,

@ProjectRespondentCompletionDate)


SELECT @ProjectRespondentId = SCOPE_IDENTITY()



INSERT INTO [RG_ProjectData].[dbo].[ProjectResponse]

([ProjectRespondentId]

,[ProjectQuestionId]

,[ProjectResponseMention]

,[ProjectResponseContent]

,[ProjectResponseOpenEndContent])

VALUES

(@ProjectRespondentId,

@ProjectQuestionId,

@ProjectResponseMention,

@ProjectResponseContent,

@ProjectResponseOpenEndContent)

COMMIT TRAN ---------------------------- Commit the transaction

'''

EXECUTE (@SQL4)
Oct 2 '06 #1
0 2473

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: June Moore | last post by:
Hi all, I have a stored procedure that return a resultset e.g. stored proc: get_employee_details select emp_id, emp_name, emp_salary, emp_position from empoloyee I would like to write...
4
by: Nyul | last post by:
Gurus, I have a verb big problem which I'm unable to explain. We have a DB2 V6.1.0 on AIX 4.3 I want to make a C stored procedure which at the end will be called by a PHP script. The...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Rhino | last post by:
This question relates to DB2 Version 6 on OS/390. Can a (COBOL) stored procedure on this platform do file I/O, i.e. write to a sequential file? I am trying to debug a stored procedure. As far...
2
by: Rhino | last post by:
I am getting an sqlcode of -927 when I execute SQL within a COBOL stored procedure in DB2 OS/390 Version 6 on OS/390. I have looked at the error message for that condition and tried everything I...
1
by: mike | last post by:
If I try and do a "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1" after I have run a stored procedure in DB2 version 7.2, I get the last generated Key before the CallableStatement was executed...
2
by: Mike Hutton | last post by:
I have a rather odd problem. I have a SP which uses temp. tables along the way, and then returns a table of results: CREATE PROCEDURE dbo.usp_myproc( @pNameList VARCHAR(6000) ) AS
14
by: Roy | last post by:
Apologies for the cross-post, but this truly is a two-sided question. Given the option of creating Looping statements within a stored proc of sql server or in the code-behind of an .net webpage,...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
4
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.