My Script:
guildMember.roles.add(welcomeRole);
guildMember.guild.channels.cache.get("805423246370930708").send("Welcome! <#$[guildMember.user.id}> to our server! Make sure to check out the #Rules channel!");
The bot was supposed to ping the member who joins but instead, it literally says "<#$[guildMember.user.id}>"
Replace your double quotes with backticks and square brackets with curly brackets. You must mention the #Rules channel as well.
Here is fixed version:
guildMember.roles.add(welcomeRole);
guildMember.guild.channels.cache.get("805423246370930708").send(`Welcome! <#${guildMember.user.id}> to our server! Make sure to check out the <#RULES_CHANNEL_ID> channel!`);
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
When I use the following to check if the DB exists using PowerShell throws an error.
Test-Path SQLSERVER:\SQL\TestServer\TestData\Databases\Data\Site1.Test.User.Com
ErrorMessage:
Test-Path : Cannot retrieve the dynamic parameters for the cmdlet. SQL Server PowerShell provider error: The number of keys specified does not match the number of keys required to address this object. The number of keys required are: Name.
Use quotes:
Test-Path "SQLSERVER:\SQL\TestServer\TestData\Databases\\Data\Site1.Test.User.Com"
or
Test-Path 'SQLSERVER:\SQL\TestServer\TestData\Databases\\Data\Site1.Test.User.Com'
Edit
The issue is escaping the periods, as the SQL Server PowerShell provider does not like them. Normally, I would expect weird characters within single quotes to be escaped.
Unfortunately I can't try this on my machine. Here are a few other escape method to try - please let me know if one of these works for you:
# I expect the regular PowerShell escape character to work
"SQLSERVER:\SQL\TestServer\TestData\Databases\Data\Site1`.Test`.User`.Com"
# If not, standard SQL syntax
"SQLSERVER:\SQL\TestServer\TestData\Databases\Data\[Site1.Test.User.Com]"
# Hexadecimal periods
"SQLSERVER:\SQL\TestServer\TestData\Databases\Data\Site1%2eTest%2eUser%2eCom"
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"
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.
Constructing a SQL Server query for the first time today, and was surprised to see that this alias didn't work:
SELECT
INVOICE_INVOICE_NUMBER AS invno,
INVOICE_INVOICE_SEQ AS lineno
FROM
INVOICED
But this did:
SELECT
INVOICE_INVOICE_NUMBER AS invoice,
INVOICE_INVOICE_SEQ AS line
FROM
INVOICED
Changing the alias name is no big deal - but it would be good to know why this particular alias didn't work and how I can prevent or be aware of any future keywords to avoid.
LineNo is a reserved word. You can encase it in brackets to use it.
SELECT INVOICE_INVOICE_SEQ AS [lineno]
Reserved words
The answer is in your question itself. Keywords change colour and you should be able to easily make that out, unless you are typing your SQL query in notepad. Ideally it is not a good practice to use keywords for aliases, but if you have to, wrap them in square brackets - [ ].
Typically, reserved words turn blue, functions turn pink and system objects turn green. Of course you do have the ability to change the font in SSMS (Options > Environment > Fonts and Colors)
Raj