SP ISSUE

I AM GETTIN THIS ERROR  Microsoft OLE DB Provider for SQL Server error '80040e07'

Invalid character value for cast specification.

/2004fallevents/updateschedule.asp, line 56


WHICH IN LINE 56 I HAVE   "call dbo.dboschedule(" + Replace(Recordset1__userid, "'", "''") + ",'" + Replace(Recordset1__vardatesss, "'", "''") + "'," + Replace(Recordset1__varevent, "'", "''") + "," + Replace(Recordset1__varsite, "'", "''") + "," + Replace(Recordset1__varfield, "'", "''") + "," + Replace(Recordset1__varteams, "'", "''") + ")}"


CREATE PROCEDURE dboschedule
@userid int,
@vardatesss  datetime,
@varevent int,
@varsite int,
@varfield int,
@varteams int
AS
SELECT *,newschedule.userid AS bestiduser,  newschedule.id AS bestid, carmelr.id AS Expr1, carmelr.refname AS Expr2, carmelr_1.id AS Expr3, carmelr_2.id AS Expr4
FROM newschedule LEFT OUTER JOIN                        events ON newschedule.EventType = events.newid LEFT OUTER JOIN                        leagues ON newschedule.League = leagues.leagueid LEFT OUTER JOIN                        eventsection ON newschedule.EevntSection = eventsection.sectionid LEFT OUTER JOIN                        sitename ON newschedule.Site = sitename.SiteID LEFT OUTER JOIN                        teams ON newschedule.CUSCTeam = teams.teamid LEFT OUTER JOIN                        carmelr ON newschedule.RefCenter = carmelr.id LEFT OUTER JOIN                        carmelr carmelr_1 ON newschedule.RefAR1 = carmelr_1.id LEFT OUTER JOIN                        carmelr carmelr_2 ON newschedule.RefAR2 = carmelr_2.id LEFT OUTER JOIN                        fielsd ON newschedule.Field = fielsd.idfields
WHERE (newschedule.EventDate = @vardatesss) AND (newschedule.EventType LIKE @varevent) AND                         (newschedule.Site LIKE @varsite) AND (newschedule.Field LIKE @varfield) AND (newschedule.CUSCTeam LIKE @varteams) and(newschedule.userid=@userid)
ORDER BY newschedule.EventDate, fielsd.FieldName
GO
LVL 1
gianitooAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

imran_fastCommented:
did you run it from the query analyzer? and get any errors.

also try this
"call dbo.dboschedule('" + Replace(Recordset1__userid, "'", "''") + "','" + Replace(Recordset1__vardatesss, "'", "''") + "','" + Replace(Recordset1__varevent, "'", "''") + "','" + Replace(Recordset1__varsite, "'", "''") + "','" + Replace(Recordset1__varfield, "'", "''") + "','" + Replace(Recordset1__varteams, "'", "''") + "')"
0
gianitooAuthor Commented:
THIS QUERY  WORKS FINE FROM ENTERPRISE MANAGER

SELECT     *, newschedule.userid AS bestiduser, newschedule.id AS bestid, carmelr.id AS Expr1, carmelr.refname AS Expr2, carmelr_1.id AS Expr3,
                      carmelr_2.id AS Expr4
FROM         newschedule LEFT OUTER JOIN
                      events ON newschedule.EventType = events.newid LEFT OUTER JOIN
                      leagues ON newschedule.League = leagues.leagueid LEFT OUTER JOIN
                      eventsection ON newschedule.EevntSection = eventsection.sectionid LEFT OUTER JOIN
                      sitename ON newschedule.Site = sitename.SiteID LEFT OUTER JOIN
                      teams ON newschedule.CUSCTeam = teams.teamid LEFT OUTER JOIN
                      carmelr ON newschedule.RefCenter = carmelr.id LEFT OUTER JOIN
                      carmelr carmelr_1 ON newschedule.RefAR1 = carmelr_1.id LEFT OUTER JOIN
                      carmelr carmelr_2 ON newschedule.RefAR2 = carmelr_2.id LEFT OUTER JOIN
                      fielsd ON newschedule.Field = fielsd.idfields
WHERE     (newschedule.EventDate = CONVERT(DATETIME, '2006-03-08 00:00:00', 102)) AND (newschedule.EventType LIKE 1) AND (newschedule.Site LIKE 1)
                      AND (newschedule.Field LIKE 1) AND (newschedule.CUSCTeam LIKE 1) AND (newschedule.userid = 1)
ORDER BY newschedule.EventDate, fielsd.FieldName
0
imran_fastCommented:
debug this from your application by putting wath

"call dbo.dboschedule('" + Replace(Recordset1__userid, "'", "''") + "','" + Replace(Recordset1__vardatesss, "'", "''") + "','" + Replace(Recordset1__varevent, "'", "''") + "','" + Replace(Recordset1__varsite, "'", "''") + "','" + Replace(Recordset1__varfield, "'", "''") + "','" + Replace(Recordset1__varteams, "'", "''") + "')"

and see wht is the string created like print it on the screen because this one is created dynamically
print the stored procedure call before executing it and post it here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
derobyCommented:
Ok, bit hard to explain, but worth investigating imho

=> you're using a couple of variables in the WHERE clause of the query (eg. @vardatesss)
These might be defined as a specific datatype (eg. datetime, or int, or whatever)

Now as you run your ASP, it seems to me that you try to pass a value from a recordset as a variable for the procedure, but by converting it to a string first. I wouldn't be too surprised if this conversion bailed out on some strange values

Another think I find rather confusing is that you do a LIKE on an int ??????

=> I'm not sure what you want to achieve here but 'WHERE field LIKE 1' actaully doesn't make sense. When comparing numeric values you should restrict to <, >, <=, >=, =, <> or !=

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.