Hui,
If you only want to use the integer value of a date/time, first set the value of $Start Date1$ to a temp integer value field. Then run the command: Select sum(C901001003-C901001002) from T255 Where C3 > $zTmp Int1$ HTH Stephen Remedy Skilled Professional ________________________________ From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] On Behalf Of Bao, Hui-Qing Sent: Tuesday, October 09, 2007 1:47 PM To: arslist@ARSLIST.ORG Subject: How to pass Date/Time varible to SQLstatement Hello All, I have a SQL statement in Set Field action, and I have to pass a Date/Time variable ($Start Date1$) to the query: Select sum(C901001003-C901001002) from T255 Where C3 > $Start Date1$ I got incorrect syntax error. The sql statement looks like this the database log: Select sum(C901001003-C901001002) from T255 Where C3 > 10/7/2007 12:00:00 AM I know Remedy store Date/Time as integer in the database (by the way, we are using MS SQL 2000), I wonder if there is any function I can use to convert Date/Time to Int before I can pass the variable to the query??? I tried server side table loop to perform the same task, but since the table is huge (couple hundreds thousands of records) always get time out, so I figure I have to use direct SQL. I opened a ticket with BMC last week, they just sent me the pdf of DatebaseRefGuide. Please help!! Hui __20060125_______________________This posting was submitted with HTML in it___ _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the Answers Are"