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

Store procedure not execute

2
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 2437
lukjos
2
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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.