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 2005 Forums
 Transact-SQL (2005)
 Error converting data type varchar to numeric.

Author  Topic 

pstarr3
Starting Member

2 Posts

Posted - 2010-08-12 : 16:59:14
why am i getting this error


DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)

mfemenel
Professor Frink

1421 Posts

Posted - 2010-08-12 : 17:05:43
That's odd. I just tried it and didn't get an error:


DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)
SELECT @InputDate
Result: 2010-08-12

Mike
"oh, that monkey is going to pay"
Go to Top of Page

pstarr3
Starting Member

2 Posts

Posted - 2010-08-12 : 17:20:07
here is the full sp

DECLARE @ReportType bit
DECLARE @RC int
DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)


-- Copy the records for the Input Date into the temporary table
EXEC @RC = dbo.BuildTempLogTable @InputDate

IF @RC = 0
BEGIN
-- Collect Vendor Totals
SET @ReportType = 0
EXEC dbo.Deduction @ReportType
EXEC dbo.Indexed @ReportType
EXEC dbo.NoDeduction @ReportType
EXEC dbo.Researched @ReportType
EXEC dbo.Reviewed @ReportType
EXEC dbo.TotalDeduction @ReportType
EXEC dbo.Voided @ReportType
EXEC dbo.Worked @ReportType

-- Collect User Totals
SET @ReportType = 1
EXEC dbo.Deduction @ReportType
EXEC dbo.Indexed @ReportType
EXEC dbo.NoDeduction @ReportType
EXEC dbo.Researched @ReportType
EXEC dbo.Reviewed @ReportType
EXEC dbo.TotalDeduction @ReportType
EXEC dbo.Voided @ReportType
EXEC dbo.Worked @ReportType
END
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-08-12 : 18:24:55
The error is in one of stored procedures you a calling or at least not in the date conversion.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-13 : 10:45:08
quote:
Originally posted by pstarr3

why am i getting this error


DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)




What is the error?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-08-13 : 11:46:16
quote:
Originally posted by madhivanan

quote:
Originally posted by pstarr3

why am i getting this error


DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)




What is the error?

Madhivanan

Failing to plan is Planning to fail

Assuming the title is correct: Error converting data type varchar to numeric.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-17 : 02:17:31
quote:
Originally posted by Lamprey

quote:
Originally posted by madhivanan

quote:
Originally posted by pstarr3

why am i getting this error


DECLARE @InputDate nvarchar(15)
SET @InputDate = LEFT(CONVERT(varchar, GETDATE(), 121), 10)




What is the error?

Madhivanan

Failing to plan is Planning to fail

Assuming the title is correct: Error converting data type varchar to numeric.


Thanks. I forgot to note that

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-08-17 : 04:42:00
What parameter type / format does BuildTempLogTable need for @InputDate?
Go to Top of Page
   

- Advertisement -