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
 General SQL Server Forums
 New to SQL Server Programming
 View Problem

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2010-04-13 : 05:32:50
Please help on this..


I have a problem to be solved
I have a view defined over a table as

Create View vTest
AS
Select * from TblName


The table has LastUpdated Column of Type Datetime.
I have a variable like @LastRunDate Datetime
I run a query like
Select * from vTest where LastUpdated >=@LastRunDate


I get a error converting into Datetime
However
select * from tblName where LastUpdated >=@LastRunDate runs successfully returning the rows that satisfy this condition.

what could be the cause


webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-13 : 05:43:49
Maybe your view isn't simple like this example?
Maybe in this view the date is already converted / concatenated or whatever?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-13 : 06:54:07
how are you passing value for @LastRunDate?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-13 : 07:10:44
quote:
Originally posted by visakh16

how are you passing value for @LastRunDate?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/


That shouldn't be the problem I think, because the var is of type datetime and the query without using the view is running.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -