Syntax error (missing operator) in query expression ‘[Type]=5 And Left([Name],1)<>"~" OORDER BY [Name]’ [closed] - sql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have to create a list box control that contains all of the queries except for the system queries. Recall that system query names begin with the ~ character.
When I try to write SQL code in the row source (in the property sheet) for my frmQueries form I keep getting an error saying:
Syntax error (missing operator) in query expression:'[Type]=5 And Left([Name],1)<>"~" OORDER BY [Name]'
The code I entered is:
SELECT [Name] FROM MYSysObjects
WHERE [Type]=5 And Left([Name],1)<>"~"
OORDER BY [Name];
I am not sure why I am getting this error or how I can fix it.

OORDER should be ORDER, MYSysObjects should (presumably) be MSysObjects, and you can also replace Left([Name],1)<>"~" with [Name] not like "~*" (assuming MS Access instead of SQL Server).

Related

How to fix SQL Server and cast and replace query? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I was past a request to replace in a table called BODYCONTENT for the BODY column and references to old server with new server.
The vendor sent the following SQL, but it failed. Any ideas on this?
update BODYCONTENT
set BODY = replace(CAST(BODY AS nvarchar(MAX), 'https://oldserver.com', 'https://newserver.com');
Error:
Msg 102, Level 15, State 1, Line 23
Incorrect syntax near ','
You are missing a right parenthesis in the CAST before the comma
update BODYCONTENT
SET BODY = replace(CAST(BODY AS nvarchar(MAX)), 'https://oldserver.com', 'https://newserver.com');

How to use sp_depends for other database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Using SQL Server 2010
For updating the tables i am using following line
update database1_ab..table1
For sp_depends i am getting error as "Incorrect syntax near '.'"
sp_depends database1_ab..table1
How to use sp_depends for referring other database tables in current database
regardless, you need to put it in single quotes... ie
sp_depends 'database1_ab..table1'
or
sp_depends '[database1_ab]..[table1]'
You can call all the sp_ -procedures also in different database like this:
database1_ab..sp_depends table1

ORA-00906: missing left parenthesis in replace [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Following SQL
select replace (IBSECM.IBSECM582CTEXT1SHRT, 'Curtina', 'Curtine') from table IBSECM;
is giving following error:
ERROR at line 1:
ORA-00906: missing left parenthesis
What am I missing?
I am using an Oracle DB.
Simply remove table keyword:
select replace (IBSECM.IBSECM582CTEXT1SHRT, 'Curtina', 'Curtine') from IBSECM;

Syntax not valid on word 'ON' in SQL join statement [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to run an SQL SELECT statement which is running correctly in SQL Server Management Studio, but I keep receiving the error while trying to run the below code in Visual Basic/Studio:
In correct syntax near the word 'ON'
Code:
com = New SqlCommand("SELECT Member_Details.mMember_ID AS 'Unique ID', Member_Details.mFirst_Name + Member_Details.mLast_Name AS 'Name', CONVERT(varchar(10),Member_Details.mDoB,103) AS 'Date of Birth', Member_Details.mGender AS 'Gender', Rep_Group.rRep_Group_Name AS 'Rep Group'" & _
"FROM Member_Details" & _
"Join(Rep_Group) ON Member_Details.mRep_Group=Rep_Group.rRep_Group_ID", con)
The error message:
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: Incorrect syntax near the keyword 'ON'.
The SQL Statement does work without the Join statement, so I think I'm just formatting it wrong in Visual Studio.
Replace Join(Rep_Group) with Join Rep_Group in your code. JOIN is not a function :)

SQL Fiddle - date format not recognized [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
So as someone advised me yesterday I'm using SQL Fiddle since it's an easy way to test database queries and SQL programming in general but I'm getting this error:
Schema Creation Failed: ORA-01821: date format not recognized
This happens in the insert line. This usually works in Oracle and I selected in the combobox on top of the page Oracle 11g. So what's the problem?
create table Reparacoes(
numero_r int,
matricula char(8),
dataEntrada date,
constraint pk_carro primary key(numero_R),
constraint check_matricula check (regexp_like(matricula,'[[:number:]]{2}-[[:alpha:]]{2}-[[:number:]]{2}')));
insert into Reparacoes values (1,'S2-SS-12',to_date('yyyy-mm-dd','2013-11-10'));
By my own stupidity I was using the to_date wrongly. It's supposed to be like this:
to_date('2013-11-10','yyyy-mm-dd'));
and not like this:
to_date('yyyy-mm-dd','2013-11-10'));