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)
 Regarding Sql

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-12-18 : 06:33:26
Ajay writes "i am developing a softwre in Vb
and connected it to sql

i don't know how to handle

SELECT * from anytable where anytable.date >=" + MydateVariable1 + " AND anytable.date <=" + MydateVariable2

Please suggest me what is the right syntex for writing date in sql query"

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2002-12-18 : 06:42:52
quote:

Ajay writes "i am developing a softwre in Vb
and connected it to sql

i don't know how to handle

SELECT * from anytable where anytable.date >=" + MydateVariable1 + " AND anytable.date <=" + MydateVariable2

Please suggest me what is the right syntex for writing date in sql query"





SELECT * from anytable where anytable.date >=@MydateVariable1 AND anytable.date <=@MydateVariable2
this is the way we do it in sql i am not sure how it is done in vb.
i guess u will have to use sp_executesql.


set @sql='SELECT * from anytable where anytable.date >= +' @MydateVariable1 '+ AND anytable.date <= + '@MydateVariable2 '

sp_executesql @sql






Expect the UnExpected
Go to Top of Page
   

- Advertisement -