Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Print statement does not produce output

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-06-19 : 18:50:22
ram writes "Hi,

I am trying to debug my stored procedure with PRINT command. I created the stored procedure in Query analyzer and ran exec command on the stored procedure.

My stored procedure has table creation,cursors etc.

I am trying to print a simple statment such as
PRINT 'This Works'

Can any one tell me why this statement is no being printed in debug window.

Below is the code snippet with print command

create procedure dbo.usp_timekeeper_time_value
as
begin
set nocount on
DECLARE @t1 DECIMAL,
@t2 DECIMAL,
@t3 DECIMAL,
@t4 DECIMAL,
@t5 DECIMAL,
@t6 DECIMAL,
@s1 INTEGER,
@s2 INTEGER,
@s3 INTEGER,
@s4 INTEGER,
@d1 DATETIME,
@d2 DATETIME,
@d3 DATETIME,
@d4 DATETIME,
@d5 DATETIME,
@c1 CHAR(80),
@c2 CHAR(80),
@c3 CHAR(80),
@c4 CHAR(80),
@mat_num CHAR(15),
@tk_num CHAR(10),
@min_date DATETIME,
@icount int,
@i int


SELECT @min_date = MIN(peendt)
FROM periodt

print 'This works'
print 'The start date is'+@min_date


CREATE TABLE dbo.tktv_tbl
(matter CHAR(15),
watty CHAR(8),
hrs_mtd DECIMAL,
hrs_ytd DECIMAL,
hrs_itd DECIMAL,
wval_mtd MONEY,
wval_ytd MONEY,
wval_itd MONEY)

CREATE INDEX itktv1 ON dbo.tktv_tbl (matter,watty)


CREATE TABLE #tk_tbl
(tkinit CHAR(8))

CREATE INDEX itktbl1 ON #tk_tbl (tkinit)

INSERT INTO #tk_tbl SELECT tkinit FROM timekeep WHERE 1=1
select count(*) from #tk_tbl

DECLARE df_tktv_cur1 CURSOR FOR
SELECT DISTINCT mtmatter FROM mattimhs,periodt
WHERE mtper = pe
AND peendt BETWEEN '01/01/2005'
AND '02/01/2005' "

cmdr_skywalker
Posting Yak Master

159 Posts

Posted - 2006-06-19 : 20:00:40
Make sure that you use the ISNULL function. Most likely, you have ANSI_PADDING setting is on.
Try using the code:

SELECT @min_date = ISNULL(MIN(peendt),getdate())
FROM periodt





May the Almighty God bless us all!
Go to Top of Page
   

- Advertisement -