troubleshooting Question

UDF not working - passing a date parameter

Avatar of metropia
metropiaFlag for United States of America asked on
Microsoft SQL ServerSQL
15 Comments4 Solutions593 ViewsLast Modified:
I created a UDF named: [dbo].[RG_DailyShippingStatusReportMonthToDate]

When I call the function like:

SELECT * FROM [dbo].[RG_DailyShippingStatusReportMonthToDate] (getdate())

I get: Line 1: Incorrect syntax near '('.

Then I replace GETDATE() with the values Ialso used when testing the function with hard-coded values:

SELECT * FROM [RGMFG].[dbo].[RG_DailyShippingStatusReportMonthToDate] (‘2013-04-01’)

But I get zero results.

I have included a copy of this UDF from when I was using hard coded values. When running it that way, I  do get results.

I am also including a copy of it, not using hard coded values.

Would someone be willing to take a look at this and see if you can locate where I am making the mistake?

Thank you very much
udf-with-hard-coded-values.txt
udf-with-out-values.txt
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 4 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros