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 :)
Related
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).
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');
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am getting unrecognized keyword when when I am running a query to join two of my sheets in excel.
Error - 2147467259 - Unrecognized keyword WHEN
This error is due to case statements, they are not accepted in JET ODBC.
I am using JET ODBC and querying within excel sheets.
Can anyone help write a proper case statement using JET ODBC syntax, i can't get this to work.
iif ([stack$].[business_name] = 'GELP'
AND [overflow$].[level] = 'Package' THEN [overflow$].[identifier1]) END AS standardized_identifier,
CASE statements are not supported in SQL when hitting Excel sheets. You are using the JET ODBC/OLEDB provider in Windows which has limited syntax.
Instead use the IIF() function which is similar syntax to Excel's If().
As an example, your first CASE would look like:
iif([stack$].[managementl6description] = 'GLOBAL EQUITY-LINKED PRODUCTS', 'GELP' , iif([stack$].[managementl6description] = 'EQUITY MARKETS', 'EQUITY MARKETS', iif([stack$].[managementl6description] = 'FOREIGN EXCHANGE', 'FIC Foreign Exchange', NULL))) AS business_name
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 5 years ago.
Improve this question
I am executing following query in oracle SQL developer
SELECT PROPERTYNO FROM VIEWING WHERE COMMENTS IS NOT NULL
UNION (SELECT PROPERTYNO FROM PROPERTYFORRENT MINUS SELECT PROPERTYNO FROM VIEWING);
but I am getting below error, though I feel my query is correct. can anyone suggest me what's wrong in my query?
SELECT PROPERTYNO FROM VIEWING WHERE COMMENTS IS NOT NULL
UNION (SELECT PROPERTYNO FROM PROPERTYFORRENT MINUS SELECT PROPERTYNO FROM VIEWING)
Error report -
ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
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;