Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2007, 06:18 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default OPENQUERY Problem

Hi,

  I have created a linked server to oracle.
I executed the query as

SELECT @Counter = count(*) from OPENQUERY([TIE DB], 'select * from ora_owner.appointment where update_dtm > to_date(''2007-oct-11 18:06:05'',''yyyy-mon-dd HH24:Mi:SS'')')

Its executing fine.

But I want to get the date from another table from my sql server.
How can I form the OPENQUERY with a variable(contains date)?

SELECT @Counter = count(*) from OPENQUERY([TIE DB], 'select * from tie_owner.rtt_appointment where update_dtm > to_date(''+ @ApptLastUPdateDateTimee + '',''yyyy-mon-dd HH24:Mi:SS'')')

This statement is giving error...
Incorrect sysntax at +

How do I get date in yyyy-mmm-dd hh:mm:ss format?
The same date I will form in the openquery.

This is struggling me a lot. Pls suggest an idea.

Thanks in advance






Similar Threads
Thread Thread Starter Forum Replies Last Post
openquery syntax mpankuj SQL Server 2000 11 March 15th, 2010 01:27 AM
Using sp_execute with OpenQuery and Parameters BCullenward SQL Language 0 October 27th, 2008 03:48 PM
OPENQUERY vs EXECUTE on a linked server? aaqqqa SQL Server 2005 1 May 28th, 2007 06:52 AM
Openquery statements aven SQL Server 2000 2 January 11th, 2006 01:33 AM
openquery gr_chris SQL Server 2000 0 September 16th, 2005 08:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.