473,387 Members | 1,721 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,387 software developers and data experts.

Getting an error When i am going to convert my SP as dynamic

I am getting an error When i am going to convert my SP as dynamic

Error :
Msg 403, Level 16, State 1, Line 21
Invalid operator for data type. Operator equals add, type equals text.

Code :

CREATE TABLE [dbo].[StudentComments] (

@Query AS VARCHAR(1000)
@DBName As NVARCHAR,

SET @DBName = 'test'
)

@Query = 'SELECT DISTINCT m.ms_id, m.ms_rev_no
FROM' + @DBName+'.manuscript m,'
+ @DBName+'.productionmanuscript p
WHERE m.j_id = p.j_id
AND ( ( m.ms_rev_no = 1
AND EXISTS (SELECT 1
FROM ' + @DBName+'.manuscript ms
WHERE (ms.ms_rev_no = 0
AND ms.ms_id = m.ms_id) ) )
INSERT INTO @TmpEditorReportSummary
(col1,
col2)
VALUES (@ROCol1,
@ROCol2')

print (@Query)
exec (@Query)
Mar 30 '11 #1
1 1300
gpl
152 100+
2 things - your table creation has a set statement in it, that would not be valid.

Your @Query string needs a space after the FROM

I havent used TEXT fields, is it valid to oncatenate them ? the error message would indicate not, so cast those columns as varchar

When developing dynamic sql, it is often useful to PRINT the generated query in query analyser to see what will be executed
Mar 30 '11 #2

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

Similar topics

0
by: Imran | last post by:
I m getting this error when i open asp.net Form Design View. "The file failed to load in the Web Form Designer. PLease Correct the following error, then load it again. The designer could not be...
1
by: dipesh | last post by:
I am getting error when trying to Add Web Reference in Visual Studio 2005. "Some of the files required for web references are not installed"
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
1
by: siddu | last post by:
Hi All, I have to do one task. First i need to copy files from vss and run bat files.i have a document with all steps. step 1: we have to take files from vss by using getlatestversion...
1
by: PulkitZery | last post by:
Hi, I am getting the following error when calling a method which i defined in web service. Any Idea?...
2
by: mak1084 | last post by:
i friends i'm getting this error when i execute the insert query.... what is the problem and how i can execute the my query? :?
1
by: jonny | last post by:
Went from using Visual Web Develop express to Visual Studio 2005 and getting error when trying to open project. Error message: "One or more projects in the solution could not be loaded for the...
0
by: =?Utf-8?B?UmF2aQ==?= | last post by:
Hi, I have WCF service and integrated with STS (WS-Federation). The Service exposes 5 endpoints Win, UNT and Federated Windows, Federated UNT and Mex endpoint. My STS Service exposes 3 endpoints...
4
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform...
1
by: NareshN | last post by:
Hi, I am getting error in following stored procedure in where condition Must declare the scalar variable "@CampaignId".I already declared CampaignId but still getting error.Please see where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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,...

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.