473,657 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in stored procedure in the last line plz help

12 New Member
HI here is the stored procedure

CREATE Procedure dm_deleteBBPost
(
@TopicID numeric,
@ForumID numeric

)
As
declare @netCount as int

BEGIN
Select @netCount=count (*) from tblBBPosts where TopicID=@TopicI D

update tblBBForums set TotalTopics=Tot alTopics-1,TotalPosts=To talPosts-@netCount where ForumID=@ForumI D

Delete From tblBBPosts Where TopicID = @TopicID
Delete From tblBBTopics Where TopicID =@TopicID

end
declare @pr_ForumsToday as varchar
declare @topicname as varchar

SELECT TOP 1 @topicname=Topi cs FROM tblBBTopics ORDER BY LastPostDate DESC
@pr_ForumsToday = ' <p><A href=''bbviewpo sts.asp?id="'+ TopicID +'>' +left(@topicnam e,50) + ' ...</a>" & "</p>")'
GO



i am getting error in the @pr_ForumsToday line
syntax error i think plz can any body help
Jul 19 '07 #1
2 1043
jhardman
3,406 Recognized Expert Specialist
What language is this?
Jul 19 '07 #2
shweta123
692 Recognized Expert Contributor
Hi,

Syntax error is in the variable declaration e.g.

declare @netCount as int
It should be : declare @netCount int

declare @pr_ForumsToday as varchar
It should be : declare @pr_ForumsToday varchar

declare @topicname as varchar
It should be : declare @topicname varchar






HI here is the stored procedure

CREATE Procedure dm_deleteBBPost
(
@TopicID numeric,
@ForumID numeric

)
As
declare @netCount as int

BEGIN
Select @netCount=count (*) from tblBBPosts where TopicID=@TopicI D

update tblBBForums set TotalTopics=Tot alTopics-1,TotalPosts=To talPosts-@netCount where ForumID=@ForumI D

Delete From tblBBPosts Where TopicID = @TopicID
Delete From tblBBTopics Where TopicID =@TopicID

end
declare @pr_ForumsToday as varchar
declare @topicname as varchar

SELECT TOP 1 @topicname=Topi cs FROM tblBBTopics ORDER BY LastPostDate DESC
@pr_ForumsToday = ' <p><A href=''bbviewpo sts.asp?id="'+ TopicID +'>' +left(@topicnam e,50) + ' ...</a>" & "</p>")'
GO



i am getting error in the @pr_ForumsToday line
syntax error i think plz can any body help
Jul 21 '07 #3

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

Similar topics

4
13463
by: marc | last post by:
I've been developing a stored procedure that uses a user defined function in the query portion of the procedure. However, since the end product needs to allow for dynamic table names, the UDF will not work. I've been trying to get this to work with converting the UDF to a procedure, but I'm having no luck. Here is the background on what I'm trying to accomplish. I need to perform a sub-identity on a table, I have the normal identity set,...
8
7737
by: Wonderinguy | last post by:
Hi everybody , I have been trying to execute a simple DB2 stored Procedure from perl. But it doesn't work. Could anybody please help me find out why this is happening : here is my perl script that execute the SP : <snip> my $dbh = DBI->connect( "dbi:DB2:$database","user1","passwd1") || die "cannot connect to db2"; my $callstmt = "CALL SPACESP('DB','TEXAS')"; my $sth = $dbh->prepare($callstmt) || die "can't do
2
9218
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 problems doing this. I wanted to implemented a generic "Helper" class like this: /** * Helper
0
2642
by: Amber | last post by:
Stored procedures are faster and more efficient than in-line SQL statements. In this article we will look at two SQL Server stored procedures; one using an input parameter and one not, and see how to call them from an ASP.Net page Every modern database system has a stored procedure language. SQL Server is no different and has a relatively sophisticated and easy to use system. This article will not attempt to go into depth in explaining...
1
4302
by: gregoryday | last post by:
I am battling to get a stored procedure to build: I have a stored procedure working in SQL Server 2000, and now need to port it to DB2. I will be accessing the stored procedure via VB.NET. The stored procedure reads a value from a table, increments the value by 1 and writes it back into the table. The table is called LOADER.CAD_AT_LAST_UNIQUE_ID, and the field is LASTKEY. When I try to build the procedure I get the following message: ...
4
7239
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
7
5840
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored procedure from a PHP program, and run a stored procedure. I have yet to figure out the proper way to do this. My stored procedures work fine from the mysql command line using syntax: "call sp_min_record (101);"
1
947
by: madhu7sudan | last post by:
HI here is the stored procedure CREATE Procedure dm_deleteBBPost ( @TopicID numeric, @ForumID numeric ) As declare @netCount as int
0
3177
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.