Access To SQL Server 7 Syntax Help

May 7, 2004

This runs in Access, but SQL Server 7 complains that BETWEEN is unrecognized. Can anyone help me? thanks


SELECT yearId, IIf(Date() BETWEEN [qrtOneStart] AND [qrtOneEnd],1, IIf(Date() BETWEEN [qrtTwoStart] AND [qrtTwoEnd], 2, IIf(Date() BETWEEN [qrtThreeStart] AND [qrtThreeEnd], 3, 4))) AS CurrentQrt, yearName
FROM tblYear

View 7 Replies


ADVERTISEMENT

Syntax To Access Database On Another Server

Feb 26, 2008

I know how to access different tables on the same server by prefixingthe table with the database name. Is there anyway to prefix theserver name to link two tables across servers? Thanks.

View 2 Replies View Related

Converting Rrom Access Syntax To Sql Syntax

Sep 23, 2007


Ok I am tying to convert access syntax to Sql syntax to put it in a stored procedure or view..
Here is the part that I need to convert:

SELECT [2007_hours].proj_name, [2007_hours].task_name, [2007_hours].Employee,
IIf(Mid([task_name],1,3)='PTO','PTO_Holiday',
IIf(Mid([task_name],1,7)='Holiday','PTO_Holiday',
IIf(Mid([proj_name],1,9) In ('9900-2831','9900-2788'),'II Internal',
IIf(Mid([proj_name],1,9)='9900-2787','Sales',
IIf(Mid([proj_name],1,9)='9910-2799','Sales',
IIf(Mid([proj_name],1,9)='9920-2791','Sales',

)
)
)
)
) AS timeType, Sum([2007_hours].Hours) AS SumOfHours
from................

how can you convert it to sql syntax

I need to have a nested If statment which I can't do in sql (in sql I have to have select and from Together for example ( I can't do this in sql):
select ID, FName, LName
if(SUBSTRING(FirstName, 1, 4)= 'Mike')
Begin
Replace(FirstNam,'Mike','MikeTest')
if(SUBSTRING(LastName, 1, 4)= 'Kong')
Begin
Replace(LastNam,'Kong,'KongTest')
if(SUBSTRING(Address, 1, 4)= '1245')
Begin
.........
End
End

end




Case Statement might be the solution but i could not do it.






Your input will be appreciated

Thank you

View 5 Replies View Related

UPDATE Into JOINed Table - Access Vs. SQL Server Syntax

Sep 13, 2007

I am trying to get a SQL statement to work with both Access 2000 and SQL Server 2000.

The statement that works in SQL Server is:

---
UPDATE [myTable2]

SET
[myTable2].[FieldA] = 'Hello',
[myTable2].[FieldB] = 2,
[myTable2].[FieldC] = 'xxx',
[myTable2].[FieldD] = 0

FROM [myTable1] INNER JOIN
(myTable2 INNER JOIN [myTable3]
ON [myTable2].[FieldX]=[myTable2].[FieldY])
ON [myTable1].[FieldZ]=[myTable2].[FieldY]

WHERE ([myTable2].[FieldY]=1)
And ([myTable3].[FieldZ]='xxx');
---


(names have been changed to protect the innocent)


The statement that works in Access is:

---
UPDATE [myTable1] INNER JOIN
(myTable2 INNER JOIN [myTable3]
ON [myTable2].[FieldX]=[myTable2].[FieldY])
ON [myTable1].[FieldZ]=[myTable2].[FieldY]

SET
[myTable2].[FieldA] = 'Hello',
[myTable2].[FieldB] = 2,
[myTable2].[FieldC] = 'xxx',
[myTable2].[FieldD] = 0

WHERE ([myTable2].[FieldY]=1)
And ([myTable3].[FieldZ]='xxx');
---


It seems that neither will accept the other format. Can anyone suggest how I can rearrange the statement so that it works in both?

View 2 Replies View Related

[Microsoft][ODBC SQL Server Driver]Syntax Error Or Access Violation'

Apr 25, 2003

Where i try to create stored procedure in sql server 2000 using query analyzer i'm getting an error

'[Microsoft][ODBC SQL Server Driver]Syntax error or access violation'

and the same stored procedure if i try after some time without any changes it gets created..

how is wrong?

View 2 Replies View Related

[Microsoft][ODBC SQL Server Driver]Syntax Error Or Access Violation

Apr 17, 2008



Hi guys! I am using SQL 2005 and I wonder why I am encountering the error "[Microsoft][ODBC SQL Server Driver]Syntax error or access violation" everytime I am trying to create stored procedure with temp table and table variable.
See my code below with temp table.


Any thoughts will be appreciated!

CREATE PROCEDURE DBO.SAMPLESP
(@DETAILS AS VARCHAR(8000),
@ID AS VARCHAR(15))


AS

BEGIN TRANSACTION

CREATE TABLE DBO.#TEMPTABLE
{
ASSET VARCHAR(50)
}

DECLARE @INSTINSERT AS NVARCHAR(4000)
SET @INSTINSERT= 'INSERT INTO #TEMPTABLE(ASSET)'
SET @INSTINSERT= @INSTINSERT+ @DETAILS

EXEC sp_ExecuteSQL @INSTINSERT

INSERT INTO InstDetail
(TrackNum, ASSETID)
SELECT @ID, A.ASSE
FROM #TEMPTABLE A

DROP TABLE #TEMPTABLE


IF @@ERROR != 0
BEGIN
ROLLBACK TRANSACTION
RAISERROR('There was an error in here', 11, 1)
RETURN
END
ELSE
COMMIT TRANSACTION

View 5 Replies View Related

MS Access SQL Syntax Error

Apr 22, 2004

There is a JOIN syntax error in this SQL, but my slow brain cannot figure out where. I tried to join two queries, which had been successful. Problem occurred when I added second left join. Can anyone help?

PARAMETERS pstrFinYear Text ( 255 ), pintAdjMonth Long;

SELECT A.BudgetLineID, A.BudgetLine, B.NumIsDevelopBusinessInternationally, B.NumIsDeeperParticipation, B.NumIsNewExporter, B.NumProjects, C.NumCompanies, A.KMISReportOrder
FROM ( tblkpBudgetLine AS A

LEFT JOIN

[SELECT BudgetLineID, FinancialYear, SUM(IsDevelopBusinessInternationally) AS NumIsDevelopBusinessInternationally, SUM(IsDeeperParticipation) AS NumIsDeeperParticipation, (-1*SUM(AdjustedNewExpMonth=pintAdjMonth)) AS NumIsNewExporter, COUNT(ProjectID) AS NumProjects
FROM qryBoardReport_Actuals
WHERE FinancialYear=pstrFinYear
AND AdjustedProjectStartMonth=pintAdjMonth
GROUP BY BudgetLineID, FinancialYear]. AS B
ON (A.BudgetLineID=B.BudgetLineID) AND (A.FinancialYear=B.BudgetLine)

LEFT JOIN

[SELECT Z.BudgetLineID, Z.FinancialYear, Z.AdjustedProjectStartMonth, COUNT(Z.Company) AS NumCompanies
FROM [SELECT DISTINCT qryBoardReport_Actuals.BudgetLineID AS BudgetLineID, qryBoardReport_Actuals.FinancialYear AS
FinancialYear, qryBoardReport_Actuals.AdjustedProjectStartMonth, qryBoardReport_Actuals.CompanyID as Company
FROM qryBoardReport_Actuals
WHERE FinancialYear=pstrFinYear
AND AdjustedProjectStartMonth=pintAdjMonth
GROUP BY qryBoardReport_Actuals.FinancialYear, qryBoardReport_Actuals.BudgetLineID, qryBoardReport_Actuals.AdjustedProjectStartMonth, qryBoardReport_Actuals.CompanyID]. AS Z
GROUP BY FinancialYear, BudgetLineID, AdjustedProjectStartMonth] as C

ON (A.BudgetLineID=C.BudgetLineID) and (A.FinancialYear=C.FinancialYear))


WHERE A.FinancialYear=pstrFinYear
ORDER BY A.KMISReportOrder;

View 8 Replies View Related

Convert Access Query To Syntax?

Aug 21, 2013

I am trying to convert a code from access Db to sql code?

II(Left([dbo_ClaimLosstype].[dscr],4)="Liab","D_Liab","D_Property"),

View 4 Replies View Related

Incorrect Syntax Near... Fine In QA Not In Access

Apr 4, 2008

I created a couple of stored procedures. One of them (let's call it SP1) dumps information into a table and then calls another stored procedure (SP2) to put the info in a temp table in crosstab format. SP1 then displays the info from the temp table.

When I execute SP1 from Query Editor, everything works perfectly. No errors are returned and my data is displayed just as expected.

When I try to execute SP1 from MS Access's pass-through query, I get the following error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ','.(#102)[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'A'(#102)

I've found that the error occurs when the SP2 is called from within SP1. If it's working fine in Query Editor, shouldn't it work from MS Access? Any insights?

View 2 Replies View Related

Syntax For WHERE Clause For Access Database

Oct 17, 2006

I have used this query statement with a SQL Server 2005 database and need to use something similar with an Access database:

SELECT products.*, Category AS Expr1
FROM products
WHERE (Category = @Category)

When I test this in a table adapter there is no preview due to lack of parameter. I seem to recall that Access uses different syntax in the WHERE filter clause (i.e., not @). Can someone help me out with this?

View 3 Replies View Related

Integration Services :: Correct Syntax To Access A Variable

Sep 30, 2015

I am having trouble finding the correct syntax to access a variable. I have a variable defined in the Variables window: The variable name is formatedDate. The DataType is String.

I am successfully setting the value of the variable in a Execute SQL Task. The SQL is as follows:

SELECT LEFT(CONVERT(VARCHAR, MAX(ReportDate), 120), 10) as formatedDate
from DimReportDates

The Result Set is set to “Single Row” and properly set up. 

No problem so far. I can see with a watch that the variable has the correct value, something like:

‘2015-09-30’

Now, in a subsequent step, a Data Flow Task, I want to access the variable. Actualy it is in the SQL statement of a OLE DB source in the Data Flow… I have the following:

Declare @sDate smalldatetime
SELECT @sDate = xxxxx

I have tried several things substituting xxxxx above, but nothing seems to work. One variation was

 @[User::formatedDate])

 Another was

((DT_WSTR, 10) @[User::formatedDate]).

I think I’m close, but just can’t get it. What is the correct syntax.

View 4 Replies View Related

What Syntax Should I Use To Connect To Access DB (having System Database) Via OPENROWSET?

Aug 9, 2007

MS SQL Server 2005 Express.
I'm trying to connect to Access DB (having System Database) via OPENROWSET.
Everything (client, server and access file) is on local drive.

This works (ODBC):


select *
from openrowset('MSDASQL',
'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:MBK.mdb;SystemDB=C:SECURED.MDW;Uid=me;Pwd=pw;',
'select * from [Mbk]')

This works (Jet.OLEDB):

select *
from opendatasource('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:MBK.mdb;Jet OLEDBystem Database=C:SECURED.MDW;User ID=me;Password=pw;')
...Mbk

This won't work (Jet.OLEDB):

select *
from openrowset('Microsoft.Jet.OLEDB.4.0',
'MS Access;Database=C:MBK.mdb;System Database=C:SECURED.MDW;UID=me;PWD=pw;',
'select * from [Mbk]')

saying ... "Wrong argument".

This won't work (Jet.OLEDB):

select *
from openrowset('Microsoft.Jet.OLEDB.4.0',
'MS Access;Database=C:MBK.mdb;SystemDB=C:SECURED.MDW;UID=me;PWD=pw;',
'select * from [Mbk]')

saying ... "There are no permissions for usage of object C:MBK.mdb". It seems that it simply hasn't found system database file C:SECURED.MDW, cause when I change SystemDB=C:SECURED.MDW to something like BlahBlahBlah=C:SECURED.MDW the same message is shown.

So, what is the right syntax for stating System Database in OPENROWSET query string? And why 'System Database' won't work?

Thank you.

View 1 Replies View Related

Execute SQL Task: Executing The Query Exec (?) Failed With The Following Error: Syntax Error Or Access Violation. Possible F

Jan 23, 2008

Hi,
I'm having an SSIS package which gives the following error when executed :

Error: 0xC002F210 at Create Linked Server, Execute SQL Task: Executing the query "exec (?)" failed with the following error: "Syntax error or access violation". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.Task failed: Create Linked Server

The package has a single Execute SQL task with the properties listed below :

General Properties
Result Set : None

ConnectionType : OLEDB
Connection : Connected to a Local Database (DB1)
SQLSourceType : Direct Input
SQL Statement : exec(?)
IsQueryStorePro : False
BypassPrepare : False

Parameter Mapping Properties

variableName Direction DataType ParameterName

User::AddLinkSql Input Varchar 0


'AddLinkSql' is a global variable of package scope of type string with the value
Exec sp_AddLinkedServer 'Srv1','','SQLOLEDB.1',@DataSrc='localhost',@catalog ='DB1'

When I try to execute the Query task, it fails with the above error. Also, the above the sql statement cannot be parsed and gives error "The query failed to parse. Syntax or access violation"

I would like to add that the above package was migrated from DTS, where it runs without any error, eventhough
it gives the same parse error message.

I would appreciate if anybody can help me out of this issue by suggeting where the problem is.

Thanks in Advance.

View 12 Replies View Related

Error 0: Syntax Error Or Access Violation

Aug 1, 2004

Hi,
I'm writing a stored procedure and when I click on the Check Syntax button its giving me the error in the subject. I'm not really sure whats wrong with this. Here is my Stored Procedure code. Any help wud be appreciated.


CREATE PROC CabsSchedule_Insert
{
@JulianDatesmallint,
@SiteCodesmallint,
@CalendarDaysmallint,
@BillPeriodsmallint,
@WorkDaysmallint,
@CalDayBillRcvd varchar(30),
@Remarksvarchar(50)
}
AS
INSERT INTO CabsSchedule
(JulianDate, SiteCode, CalendarDay, BillPeriod, WorkDay, CalDayBillRcvd, Remarks)
VALUES
(@JulianDate, @SiteCode, @CalendarDay, @BillPeriod, @WorkDay, @CalDayBillRcvd, @Remarks)


Thanks,

View 2 Replies View Related

Incorrect Syntax Near The Keyword CONVERT When The Syntax Is Correct - Why?

May 20, 2008

Why does the following call to a stored procedure get me this error:


Msg 156, Level 15, State 1, Line 1

Incorrect syntax near the keyword 'CONVERT'.




Code Snippet

EXECUTE OpenInvoiceItemSP_RAM CONVERT(DATETIME,'01-01-2008'), CONVERT(DATETIME,'04/30/2008') , 1,'81350'




The stored procedure accepts two datetime parameters, followed by an INT and a varchar(10) in that order.

I can't find anything wrong in the syntax for CONVERT or any nearby items.


Help me please. Thank you.

View 7 Replies View Related

Incorrect Syntax When There Appears To Be No Syntax Errors.

Dec 14, 2003

I keep receiving the following error whenever I try and call this function to update my database.

The code was working before, all I added was an extra field to update.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'


Public Sub MasterList_Update(sender As Object, e As DataListCommandEventArgs)

Dim strProjectName, txtProjectDescription, intProjectID, strProjectState as String
Dim intEstDuration, dtmCreationDate, strCreatedBy, strProjectLead, dtmEstCompletionDate as String

strProjectName = CType(e.Item.FindControl("txtProjectName"), TextBox).Text
txtProjectDescription = CType(e.Item.FindControl("txtProjDesc"), TextBox).Text
strProjectState = CType(e.Item.FindControl("txtStatus"), TextBox).Text
intEstDuration = CType(e.Item.FindControl("txtDuration"), TextBox).Text
dtmCreationDate = CType(e.Item.FindControl("txtCreation"),TextBox).Text
strCreatedBy = CType(e.Item.FindControl("txtCreatedBy"),TextBox).Text
strProjectLead = CType(e.Item.FindControl("txtLead"),TextBox).Text
dtmEstCompletionDate = CType(e.Item.FindControl("txtComDate"),TextBox).Text
intProjectID = CType(e.Item.FindControl("lblProjectID"), Label).Text

Dim strSQL As String
strSQL = "Update tblProject " _
& "Set strProjectName = @strProjectName, " _
& "txtProjectDescription = @txtProjectDescription, " _
& "strProjectState = @strProjectState, " _
& "intEstDuration = @intEstDuration, " _
& "dtmCreationDate = @dtmCreationDate, " _
& "strCreatedBy = @strCreatedBy, " _
& "strProjectLead = @strProjectLead, " _
& "dtmEstCompletionDate = @dtmEstCompletionDate, " _
& "WHERE intProjectID = @intProjectID"

Dim myConnection As New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("connectionstring"))
Dim cmdSQL As New SqlCommand(strSQL, myConnection)

cmdSQL.Parameters.Add(new SqlParameter("@strProjectName", SqlDbType.NVarChar, 40))
cmdSQL.Parameters("@strProjectName").Value = strProjectName
cmdSQL.Parameters.Add(new SqlParameter("@txtProjectDescription", SqlDbType.NVarChar, 30))
cmdSQL.Parameters("@txtProjectDescription").Value = txtProjectDescription
cmdSQL.Parameters.Add(new SqlParameter("@strProjectState", SqlDbType.NVarChar, 30))
cmdSQL.Parameters("@strProjectState").Value = strProjectState
cmdSQL.Parameters.Add(new SqlParameter("@intEstDuration", SqlDbType.NVarChar, 60))
cmdSQL.Parameters("@intEstDuration").Value = intEstDuration
cmdSQL.Parameters.Add(new SqlParameter("@dtmCreationDate", SqlDbType.NVarChar, 15))
cmdSQL.Parameters("@dtmCreationDate").Value = dtmCreationDate
cmdSQL.Parameters.Add(new SqlParameter("@strCreatedBy", SqlDbType.NVarChar, 10))
cmdSQL.Parameters("@strCreatedBy").Value = strCreatedBy
cmdSQL.Parameters.Add(new SqlParameter("@strProjectLead", SqlDbType.NVarChar, 15))
cmdSQL.Parameters("@strProjectLead").Value = strProjectLead
cmdSQL.Parameters.Add(new SqlParameter("@dtmEstCompletionDate", SqlDbType.NVarChar, 24))
cmdSQL.Parameters("@dtmEstCompletionDate").Value = dtmEstCompletionDate
cmdSQL.Parameters.Add(new SqlParameter("@intProjectID", SqlDbType.NChar, 5))
cmdSQL.Parameters("@intProjectID").Value = intProjectID

myConnection.Open()
cmdSQL.ExecuteNonQuery
myConnection.Close()

MasterList.EditItemIndex = -1
BindMasterList()


End Sub

Thankyou in advance.

View 3 Replies View Related

Which Is Faster? Conditional Within JOIN Syntax Or WHERE Syntax?

Mar 31, 2008

Forgive the noob question, but i'm still learning SQL everyday and was wondering which of the following is faster? I'm just gonna post parts of the SELECT statement that i've made changes to:

INNER JOIN Facilities f ON e.Facility = f.FacilityID AND f.Name = @FacilityName

OR

WHERE f.Name = @FacilityName


My question is whether or not the query runs faster if i put the condition within the JOIN line as opposed to putting in the WHERE line? Both ways seems to return the same results but the time difference between methods is staggering? Putting the condition within the JOIN line makes the query run about 3 times faster?

Again, forgive my lack of understanding, but could someone agree or disagree and give me the cliff-notes version of why or why not?

Thanks!

View 4 Replies View Related

Data Access :: Server Rejected The Connection - Access To Selected Database Has Been Denied

Jun 10, 2015

I have recently upgraded to SQL2014 on Win2012. The Access front end program works fine.

But, previously created Excel reports with built in MS Queries now fail with the above error for users with MS 2013.  The queries still work for users still using MS 2007. 

I also cannot create any new queries and get the same error message. If I log on as myself on the domain to another PC with 2007 installed it works fine, so I don't think it is anything to do with AD groups or permissions.

View 6 Replies View Related

Multi-user Access Through A Data-access Layer/remoting Server

Oct 30, 2007

Hi guys,

I've been developing desktop client-server and web apps and have used Access and SQL Server Standard most of the time.
I'm looking into using SQL CE, and had a few questions that I can't seem to get a clear picture on:

- The documentation for CE says that it supports 256 simultaneous connections and offers the Isolation levels, Transactions, Locking, etc with a 4GB DB. But most people say that CE is strictly a single-user DB and should not be used as a DB Server.
Could CE be extended for use as a multi-user DB Server by creating a custom server such as a .NET Remoting Server hosted through a Windows Service (or any other custom host) on a machine whereby the CE DB would run in-process with this server on the machine which would then be accessed by multiple users from multiple machines??
Clients PCs -> Server PC hosting Remoting Service -> ADO.NET -> SQL CE

- and further more can we use Enterprise Services (Serviced Components) to connect to SQL CE and further extend this model to offer a pure high-quality DB Server?
Clients PCs -> Server PC hosting Remoting Service -> Enterprise Services -> ADO.NET -> SQL CE

Seems quite doable to me, but I may be wrong..please let me know either ways

Thanks,
CP

View 3 Replies View Related

Can I Access MS Access Table In A Select Query Of SQL Server

Nov 29, 2006

Is there a way to specify a MS Access table (or query object) in the select query of SQL Server.

Ex.:

MSAccessTable (in file.mdb)



col1
col2

a1
a2

b1
b2

SQL query in SQL Server:

SELECT col1, col2 into SqlTable from [file.mdb].MSAccessTable;

Thanks,

View 3 Replies View Related

Data Access :: Server Does Not Exist Or Access Denied

Apr 22, 2015

When i am trying to start our hospital software based on SQL server 2000, it shows Following Error.Search Condition is not valid, (DBNETLIB) Connection Open (connect()).  SQL server does not exist or excess denied. Due to Fetch data.I run our software in Windows 8.1, while it smothly runs in previous version of Windows XP and 7.

View 2 Replies View Related

T-SQL (SS2K8) :: OPENQUERY Syntax To Insert Into Server Table From Oracle Linked Server

Aug 28, 2014

I was trying to figure out what the OPENQUERY Syntax is to Insert into SQL Server Table from Oracle Linked Server.

View 7 Replies View Related

Possible To Keep MS Access Interface And Migrate The MS Access To MS SQL Server?

Oct 31, 2005

Hello allWould it be possible to migrate the MS Access 2000 to MS SQL Server2000?My application is using MS Access 2000 as database and as userinterface such as forms. Now, I want to migrate the backend databasefrom MS Access 2000 to MS SQL Server 2000. However, I want to keep theMS Access 2000 interface. Would it be possible?If I migrate the MS Access to SQL Server, would the queries, back-endVBA, macro, tables and forms be affected? Do I need to change the MSAccess data type to SQL server supported data type?Which tool I can use to do the migration? Upsizing wizard or exportingthe Access database and then importing it to the SQL server?Thanks in advanceCheersBon

View 4 Replies View Related

Trying To Access SQL SERVER 2005 With Access 2003

Dec 18, 2006



I am trying to connect through ODBC connectivity, but it will not allow me to do so. I have investigated this matter. It leads me back to the server, because as I was configuring my client side database. It kept asking for the DSN(datasource name), but I was unable to choose one because there wasn't one to choose. Which is my current dilemma, How can I do this and have it available to choose from the server to satisfy the Access database?

I went to the domain where the software resides but I don't know what steps to take? I also found an interesting piece on microsoft about Kerberos, but I can't follow along according to the instructions it has. I have Access 2003 & SQL SERVER 2005, HELP...!

Basically, this is right off the heels of the install. I setup the server without the connectivity, but it is running the current configuration.

View 7 Replies View Related

Is There Any Syntax Like This In SQL Server ?

Oct 6, 2004

Query :

select * from Item1 a (NOLOCK, Index(ItemIn1))
join Item2 b (NOLOCK, Index(ItemData1))

Please explain the above nolock etc after the alias in the given query. What it does ?

Sam.

View 8 Replies View Related

SQL Server Syntax Parsing

Feb 23, 2008

Hi All,

In SQL Studio, there is a really handy option to parse your query prior to running it (that little green tick button next to Execute).

I dont suppose there is a similar thing that can be used on the command line at all is there??

Cheers
-
Karym6

View 2 Replies View Related

Server Query Syntax Help

Nov 5, 2006

Hi,

Following is my one of the field of Server table and it s data (SQL Server 2000 Desktop Ver.)

WORK_DESC
G/B SHADE
VALVE R/C
R/C
R/C ISU IND
CP FLANGE R/C
R/C
FAB. KICK LINE
COAT R/C LINE
R/C

To get the specific data of this WORK_DESC from table, I used following query which results fine.

SELECT RpoMstId, RPO_No, Start_Date, WORK_DESC
FROM T_RPO_Master
WHERE (WORK_DESC = N'R/C')

Which results:

R/C
R/C
R/C

What would be the syntax if I need to represent the data that has R/C prefix or suffix in the data field? (anywhere in the data column)

With kind regards,
Ashfaque

View 7 Replies View Related

Syntax Error In Sql Server

Apr 25, 2008

hi anybody know what is meaning of "Syntax error converting datetime from character string" is data entry problem, tq

View 5 Replies View Related

Sql Server Transaction Syntax Help

Jul 23, 2005

Hi,I have an issue with my query.1. I have 1 stored proc which have execution calls to multiple storedprocs within it.2. I want to wrap that main stored proc in the transaction and rollbackif there are errors execution calls to other stored procs. I don'tbelieve my code is accounting for errors occuring in the executionstatement to other stored proc.3. Is there an easy way to do this without creating tranaction on eachstored proc and returning the error code? How do I make this happen?Below is the code.Thanks:DALTER procedure spAG_Add_Product@prodCostmoney,@prodWeightdecimal,@prodDescnvarchar(100),@prodNamenvarchar(50),@prodSizenvarchar(100),@pic_filenamenvarchar(50),@userIdint,@exhib_idintASdeclare @auth_Logic_idintdeclare @intErrorCodeintBEGIN TRANSELECT @auth_Logic_id= AG_Auth_Logic.Auth_Logic_ID FROMAG_Auth_LogicINNER JOIN AG_Base_Active_State ON AG_Auth_Logic.Base_Active_State_ID= AG_Base_Active_State.Base_Active_State_IDWHERE AG_Auth_Logic.Action_Description LIKE N'%category%'AND AG_Base_Active_State.Is_Alive = 1INSERT INTO AG_Individual_Product(Product_cost,Product_weight,Product_description,Product_name,User_ID,Auth_Logic_Id,Product_size)VALUES (@prodCost,@prodWeight,@prodDesc,@prodName,@userId,@auth_Logic_id,@prodSize)declare @prod_idintselect @prod_id = Scope_identity()-- add to pic tabledeclare @pic_id_outintexec spAG_Add_Picture @pic_filename,@prodName, @pic_id = @pic_id_outoutputdeclare @prod_pic_outint-- add to product_pic tableexec spAG_Add_Product_Picture @pic_id_out,@prod_id, @prod_pic_id = @prod_pic_out output-- add to product_pic_in_exhibexec spAG_Add_Product_Picture_in_Exhibition @prod_pic_out,@exhib_id, @prod_idselect @prod_idSELECT @intErrorCode = @@ERRORIF (@intErrorCode <> 0) GOTO PROBLEMCOMMIT TRANPROBLEM:IF (@intErrorCode <> 0) BEGINROLLBACK TRANEND

View 1 Replies View Related

CF / SQL Server Syntax Error HELP

Jul 20, 2005

I am not sure why this is producing a SQL Server related error, but w/ohaving an instance of SQL Server on my machine to verify anything further,can you all help me with this?<!--- validate() ---><cffunction name="validate" access="remote" returnType="numeric"><cfargument name="username" required="yes" type="string" /><cfargument name="password" required="yes" type="string" /><cfquery name="validate" datasource="#request.dsn#">SELECT userIDFROM UserWHERE username = '#UCase(username)#'AND password = '#UCase(password)#'</cfquery><cfif validate.RecordCount EQ 0><cfquery name="log" datasource="#request.dsn#">UPDATE UserSET lastLoggedIn = #createOdbcDate(now())#WHERE userId = #validate.userID#</cfquery><cfreturn validate.userID /><cfelse><cfreturn 0 /></cfif></cffunction>Sorry that's all I can honestly provide, other than the error being on theline with <cfif validate.RecordCount>Phil

View 2 Replies View Related

SQL Server ASP Syntax Error

Jul 20, 2005

Hi,I'm new to ASP and have stumbled across what appears to be a commonproblem, but after trying several solutions from other posts I've hadno luck. My SQL SELECT statement is fine elsewhere (e.g. in ACCESS),but when executed from ASP I get this syntax error:Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrectsyntax near '16'./forecast/test.asp, line 27(line 27 is where the date is in the HAVING part of the statement)Here is the Statement:----------------------SELECT dbo_ForecastIn.DataTime AS E_Time, dbo_ForecastInData.DataTimeAS FD_Time, dbo_ForecastInData.WindFarmPower AS ForecastPower FROMdbo_ForecastIn INNER JOIN dbo_ForecastInData ON dbo_ForecastIn.DataID= dbo_ForecastInData.DataID GROUP BY dbo_ForecastIn.DataTime,dbo_ForecastInData.DataTime, dbo_ForecastInData.WindFarmPower HAVINGdbo_ForecastIn.DataTime = #06/02/2004 16:00:00# ORDER BYdbo_ForecastIn.DataTime, dbo_ForecastInData.DataTime;Here is the code:-----------------SQLStmt = "SELECT dbo_ForecastIn.DataTime AS E_Time,dbo_ForecastInData.DataTime AS FD_Time,dbo_ForecastInData.WindFarmPower AS ForecastPower "SQLStmt = SQLStmt & "FROM dbo_ForecastIn INNER JOINdbo_ForecastInData ON dbo_ForecastIn.DataID =dbo_ForecastInData.DataID "SQLStmt = SQLStmt & "GROUP BY dbo_ForecastIn.DataTime,dbo_ForecastInData.DataTime, dbo_ForecastInData.WindFarmPower "SQLStmt = SQLStmt & "HAVING dbo_ForecastIn.DataTime = #06/02/200416:00:00# "SQLStmt = SQLStmt & "ORDER BY dbo_ForecastIn.DataTime,dbo_ForecastInData.DataTime;"response.write(SQLStmt)Set RS = Connection.Execute(SQLStmt)Hope one of you geniuses can sort me out.Thanks.

View 1 Replies View Related

ADO 2.7 With Sql Server Using Oracle Syntax

Nov 12, 2006

Hi,
I've been tasked with investigating how we can migrate from oracle to sql server. I have successfully converted a typical schema with 97% success using SSMA and have a query regarding ADO and oracle syntax.

I have heard that the SQL server provider can interpret oracle syntax into its own syntax, but i am unable to find any reference/examples on the web. Is this possible? and if so could any kind soul please post some links.

Thanks in advance,
Michael

View 1 Replies View Related

How SQL Server Do Syntax Check?

Aug 23, 2007

declare @b nvarchar(1)
set @b = '1'


if(@b='1')
begin
select * into #example from example
select * from #example
drop table #example
end
else
begin
select * into #example from example
select * from #example
drop table #example
end
With syntax check, I always get "'#example already exist'"
But why? Just because of two "select into temp table" operation?
I am confused.
Thank you.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved