K
Krutika
I'm trying to migrate the following queries to T-SQL for SQL Server 2005, but
getting errors.
SELECT
tblCurrent.AutoNumber,
tblCurrent.TaxYear,
tblCurrent.TaxType,
tblCurrent.FEIN,
tblCurrent.CompanyName,
-(TotalAmount) AS Amount,
tblCurrent.AccountID,
tblCurrent.ParticipantInfo,
'Refund' AS FileName,
GetDate() & ' Recd ' & [ParticipantInfo] AS Comment,
'No' AS RefundToBeProcessed,
tblCurrent.Payee,
tblCurrent.Address1,
tblCurrent.Address2,
tblCurrent.Address3,
tblCurrent.Department,
tblCurrent.ToSSCRTT
FROM tblCurrent
WHERE (((tblCurrent.AutoNumber) Between
([forms]![frmTaxUnitMain]![txtAutonumberFrom]) And
([forms]![frmTaxUnitMain]![txtAutonumberTo])) AND ((tblCurrent.Archived)=-1));
ERROR: Inccorect syntax near '!' in 'Where' Clause
**************************************
UPDATE tblCheckNumber
INNER JOIN tblHistory
ON tblCheckNumber.Autonumber = tblHistory.AutoNumber
SET tblHistory.CheckAmount = ([tblchecknumber].[amount1]),
tblHistory.CheckNumber = [tblchecknumber].[checknumber],
tblHistory.CheckDate = [tblchecknumber].[checkdate],
tblHistory.AccountNumber = [tblchecknumber].[AccountNumber],
tblCheckNumber.Updated = "YES"
WHERE (((tblHistory.CheckAmount) Is Null Or (tblHistory.CheckAmount)=0)
AND ((tblHistory.CheckNumber) Is Null) AND
((tblHistory.CheckDate) Is Null) AND ((tblHistory.AccountNumber) Is Null));
ERROR: Incorrect syntax near the keyword 'INNER'. Incorrect syntax near
'tblHistory'.
******************************************
SELECT
tblEmployee.Name [Name],
tblEmployee.Department,
tblEmployee.Location,
tblEmployee.Ext,
tblEmployee.Manager,
tblEmployee.DateActivated,
tblEmployee.Authorization AS [Authorization],
tblEmployee.ReadOnly,
tblEmployee.Email
FROM tblEmployee;
ERROR: Incorrect syntax near the keyword 'Authorization'.
I tried aliasing Authorization, but still shows error
getting errors.
SELECT
tblCurrent.AutoNumber,
tblCurrent.TaxYear,
tblCurrent.TaxType,
tblCurrent.FEIN,
tblCurrent.CompanyName,
-(TotalAmount) AS Amount,
tblCurrent.AccountID,
tblCurrent.ParticipantInfo,
'Refund' AS FileName,
GetDate() & ' Recd ' & [ParticipantInfo] AS Comment,
'No' AS RefundToBeProcessed,
tblCurrent.Payee,
tblCurrent.Address1,
tblCurrent.Address2,
tblCurrent.Address3,
tblCurrent.Department,
tblCurrent.ToSSCRTT
FROM tblCurrent
WHERE (((tblCurrent.AutoNumber) Between
([forms]![frmTaxUnitMain]![txtAutonumberFrom]) And
([forms]![frmTaxUnitMain]![txtAutonumberTo])) AND ((tblCurrent.Archived)=-1));
ERROR: Inccorect syntax near '!' in 'Where' Clause
**************************************
UPDATE tblCheckNumber
INNER JOIN tblHistory
ON tblCheckNumber.Autonumber = tblHistory.AutoNumber
SET tblHistory.CheckAmount = ([tblchecknumber].[amount1]),
tblHistory.CheckNumber = [tblchecknumber].[checknumber],
tblHistory.CheckDate = [tblchecknumber].[checkdate],
tblHistory.AccountNumber = [tblchecknumber].[AccountNumber],
tblCheckNumber.Updated = "YES"
WHERE (((tblHistory.CheckAmount) Is Null Or (tblHistory.CheckAmount)=0)
AND ((tblHistory.CheckNumber) Is Null) AND
((tblHistory.CheckDate) Is Null) AND ((tblHistory.AccountNumber) Is Null));
ERROR: Incorrect syntax near the keyword 'INNER'. Incorrect syntax near
'tblHistory'.
******************************************
SELECT
tblEmployee.Name [Name],
tblEmployee.Department,
tblEmployee.Location,
tblEmployee.Ext,
tblEmployee.Manager,
tblEmployee.DateActivated,
tblEmployee.Authorization AS [Authorization],
tblEmployee.ReadOnly,
tblEmployee.Email
FROM tblEmployee;
ERROR: Incorrect syntax near the keyword 'Authorization'.
I tried aliasing Authorization, but still shows error