I am trying to set up a linked server connection to a SQL Server that is specifying the port at the end, like this:
[My-Server-PROD-01,5983]
However, it kicks back an error saying the dash is invalid. The server name is surrounded by braces like it is supposed to so I think it is the comma in the server name. Can someone tell me how to get that to work? Do I need to do some escaping of the comma? Surround it by quotes or braces?
#jthalliens - "what about using the IP address from [My-Server-PROD-01,5983] in order to avoid conflicts"
Related
I have a problem on my Debian server with MariaDB on it.
I'm trying to grant all privileges to a user ('agricoop') on my database called extranet-agricoop.
I'm writing : GRANT ALL PRIVILEGES ON extranet-agricoop.* TO 'agricoop'#'localhost';
I get the error message : "You have an error in your SQL syntax [...] near 'extranet-agricoop.* TO 'agricoop'#'localhost'' at line 1"
It worked for my other users on other table but just not for that one. If I select ‘*.*´ it works so for me the problem seems to come from the name of the db. I've tried to escape the separator but still not working.
Have you got any idea ?
Thanks :)
Identifiers have to be quoted if it contains one or more character which is not part of [a-z,A-Z,0-9,$,_] (or isn't a unicode character > 0x0080).
If sql_mode ANSI_QUOTES is set, you have to use double quotes ("), if sql_mode is MSSQL square brackets([..]) have to be used.
Example:
GRANT ALL ON `better-use-dash-than-minus`.* TO foo#localhost
I am currently working on a project where is need to send existing tables with all their fields to an sql database (backend).
what i have so far is to generate an make-table query and then execute it, but i allways get the error....
"SELECT statement includes a reserved word or an argument name that is
misspelled or missing, or the punctuation is incorrect."
the generated string is SELECT * INTO (Provider=SQLOLEDB;SERVER=stserver;DATABASE=stdatabase;UID=userid;PWD=userpass).AAAANewTable FROM AAAANewTable WITH OWNERACCESS OPTION;
of cause the stdatabase and userid ect, are string variables :-)
Can anyone help me with the correct syntax? or give an example of what the correct syntax should look like?
Any help would be greately appreciated.
I am working on what should be a super simple query for SQL Server 2014. All I want to do is check that our systems can interface with SQL Server after updates, etc. So I need to just verify that it makes the connection correctly and finds a table within the Server.
Attempt 1:
SELECT TOP (1) *
From [X].[dbo].[Y]
WITH (NOLOCK);
But apparently 'top' is not a supported option with SQL Server 2014.
To add some more, here is the exact error I get when trying to run that: Syntax error. The token 'Top' is invalid. Please check the case of your operators (eg 'or' versus 'OR') and check that your functions use brackets after the function name eg Now(), eg Len("abc").
Attempt 2:
SELECT *
From [X].[dbo].[Y]
WITH (NOLOCK)
LIMIT (1);
That one tells me that I need to put data items between [], text between "", and functions as FunctionName(). However...I don't see where I missed any of those.
Can anybody possibly shed some light on why my query isn't going through? Any help would be appreciated.
The first attempt should work just fine:
SELECT TOP (1) *
From [dbo].[Y]
WITH (NOLOCK);
See example
If it doesn't work, you should include the error message.
I am using nodes mssql module in order to connect to mssql database. However my password contains # and the pattern to the connection is
mssql://username:password#localhost/database
It throws connection error. I assume it is because it sees # so content after it it takes as localhost and so on.
Is there a way how to connect there with password that contains #?
Thanks
From MSDN:
certain symbols must be enclosed by double quotation marks (") or square brackets ([ ]).
Use these delimiters in Transact-SQL statements when the SQL Server login, user, role, or password has the following characteristics:
1.Contains or starts with a space character.
2. Starts with the $ or # character.
So I want to create a database link in oracle, my username is jefferson and I want to connect trough opms so I was told to do this.
create database link tmpp connect to jefferson[opms] identified by nothing using $something ;
For some reason when I try to use [] syntax it just tells me indentified is missing. Why is this not working, I was told to do it this way but I can't find any help in the official documentation for [] usage or the correct syntax.
You can create a fixed-user database link like this, but you need to enclose the entire proxy user identifier in double-quotes; and because it's now a quoted identifier the case has to match the DBA_USERS username, which is uppercase by default:
create database link tmpp connect to "JEFFERSON[OPMS]" identified by nothing using ... ;
As noted in MOS document 1477939.1 you can't create a connected-user database link (which you aren't trying to do); and the 30-character limit on identifiers applies, so the total length of both usernames plus the square brackets has to be 30 characters or less (which is also fine in your example).
However, as discussed in this related question, this functionality is currently broken in 11.2.0.4 and above because of bug 19191702.