473,493 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Store procedure not execute

2 New Member
Hi every,

I did create the following store procedure , but when I execute I get a timeout error and nothing done even I ran it in local db

-----------------------------------------
CREATE PROCEDURE create_mat AS

declare @loop_cnt int,
@max_cnt int,
@cur_month char(6),
@from_month char(6),
@to_month char(6);
select @max_cnt=2
select @loop_cnt = 1


TRUNCATE table F_IMS_Sales_24_Months_MAT

WHILE (@loop_cnt < @max_cnt)
BEGIN

select @cur_month = CONVERT(char(6), DATEADD(month, - (@loop_cnt-1), GETDATE()), 112)
select @from_month = CONVERT(char(6), DATEADD(month, - @loop_cnt, GETDATE()), 112)
select @to_month = CONVERT(char(6), DATEADD(month, - (@loop_cnt+12), GETDATE()), 112)

INSERT INTO F_IMS_Sales_24_Months_MAT
SELECT IMS_Outlet_Code, IMS_Outlet_Type_Code, IMS_Pack_Code, IMS_Brick_Code, @cur_month AS Date, SUM(Sales) AS Sales, SUM(Units) AS Units
FROM F_IMS_Sales_5_Years
WHERE ([Date] >= @from_month) AND ([Date] <= @to_month)
GROUP BY IMS_Outlet_Code, IMS_Outlet_Type_Code, IMS_Pack_Code, IMS_Brick_Code

select @loop_cnt=@loop_cnt+1
END
GO

--------------------------------

Is any problem on the above script.

Thanks in advance for any help

Regards,
luk
Aug 23 '05 #1
1 2443
lukjos
2 New Member
Worng typing in the querry, problem fixed
Aug 24 '05 #2

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

Similar topics

7
2838
by: George | last post by:
Hi , I am getting the below error while i am invoking a Java stored procedure from another java stored procedure. SQL0751N Routine "" (specific name "") attempted to execute a statement...
5
12390
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
1
6119
by: Hugo Lefevre | last post by:
Dear, I have a problem : I have a database which contains my data of hardware. The Id is a varchar and I want at my filling form that my user know which is the last one. So I made a store...
3
1476
by: serge calderara | last post by:
Dear all, One simple question relative to store procedure withinh ASP code on a web page. Let say that I am calling a store procedure to execute from a server button click on my web page. That...
4
2321
by: Rob | last post by:
Using VB.net and SQL server... I have a stored procedure that is simply returning a row count.... I know how to execute a stored procedure and add the output parameter. But how do I store...
2
1532
by: Gary | last post by:
if I have 1000 cobol insructions running in batch, and I have 1000 cobol instructions running in a store procedure, which one will be more efficient (execute faster) or there is no difference. and...
1
7847
by: eRTIS SQL | last post by:
hi, I want to use a stored procedure inside a stored procedure simulteanously changing the database. this is my base store procedure alter PROCEDURE create_file @dbname sysname AS declare...
11
4346
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so many parameters need to be passed into store...
2
1448
by: kuchel | last post by:
Hi I am trying to run 4 - 5 store procedure in a strict order. I have created a SSIS package whereby I trying to execute store procedure in a orderly fashion. I have created constraints between...
0
6989
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
7157
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
7195
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...
1
6873
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...
0
7367
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...
1
4889
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...
0
4579
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...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.