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
 Transact-SQL (2000)
 How do I convert variable using the OpenQuery function of SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-10 : 15:22:31
Kent writes "I cannot save this query to run it, it doesn't want to be conjegated, can you do the convert function on a variable? Your help would be greatly appreciated. I am using SQL Server 7.0 no service packs apply, my Windows version is Windows 2000 sp2


CREATE PROCEDURE qryGetGPSSalesDataP1

@BeginDate datetime,
@EndDate datetime

AS

INSERT INTO DailyTrans ( CustNmbr, TranDate, TranType, Itmclscd, Class, Price, Qty )
SELECT * FROM OPENQUERY(PARIS,
'SELECT LTRIM(RTRIM(CUSTNMBR)) AS Expr1, DOCDATE,
LTRIM(RTRIM(Sale_Type)) AS Expr2,
LEFT(LTRIM(RTRIM(ITMCLSCD)), 4) AS Expr3,
LTRIM(RTRIM(ITMCLSCD)) AS Expr4, Sales, Qty
FROM dbo.PVI_DW_D_Cust_IVClass_SaleType
WHERE DOCDATE BETWEEN' + CONVERT(varchar(12), @BeginDate) + ' AND ' + CONVERT(varchar(12), @EndDate))
"
   

- Advertisement -