ERROR QUERY

05/19/2016 02:05 THEXxmateo#1
Hello, someone help me, Run this query and I get this error

ERROR
Msg 195, Level 15, State 10, Line 3
'CONCAT' is not a recognized built-in function name.
Msg 195, Level 15, State 10, Line 11
'CONCAT' is not a recognized built-in function name.
Msg 195, Level 15, State 10, Line 19
'CONCAT' is not a recognized built-in function name.
Msg 195, Level 15, State 10, Line 24
'CONCAT' is not a recognized built-in function name.

Help Please
05/19/2016 04:31 wallerus#2
From what I can tell, CONCAT is used when you want to join one string with another, which is ok for what you want to do but you are probably better off using the + operator instead, it's simpler. Although not actually present in the script that would most efficiently get the job done.

Code:
-- Character Tags.
USE PS_GameData
UPDATE Chars
SET CharName =
	CASE
	WHEN Family IN (0,1) THEN 'L-*'
	WHEN Family IN (2,3) THEN 'F-*' 
END + CharName

-- Guild Tags.
USE PS_GameData
UPDATE Guilds
SET GuildName =
	CASE
	WHEN Country = 0 THEN 'L-*'
	WHEN Country = 1 THEN 'D-*'
END + GuildName
Credits to Nubness for teaching me more about CASE statements.
05/19/2016 04:42 sominus#3
Code:
'CONCAT' is not a recognized built-in function name.
The CONCAT function requires SQL Server 2012

removed...
05/19/2016 15:00 THEXxmateo#4
Quote:
Originally Posted by sominus View Post
Code:
'CONCAT' is not a recognized built-in function name.
The CONCAT function requires SQL Server 2012

removed...
Quote:
Originally Posted by wallerus View Post
From what I can tell, CONCAT is used when you want to join one string with another, which is ok for what you want to do but you are probably better off using the + operator instead, it's simpler. Although not actually present in the script that would most efficiently get the job done.

Code:
-- Character Tags.
USE PS_GameData
UPDATE Chars
SET CharName =
	CASE
	WHEN Family IN (0,1) THEN 'L-*'
	WHEN Family IN (2,3) THEN 'F-*' 
END + CharName

-- Guild Tags.
USE PS_GameData
UPDATE Guilds
SET GuildName =
	CASE
	WHEN Country = 0 THEN 'L-*'
	WHEN Country = 1 THEN 'D-*'
END + GuildName
Credits to Nubness for teaching me more about CASE statements.
Thank you so much guys! :)

---

It lacks the UserMaxGrow the script

sorry for my English
05/19/2016 23:55 wallerus#5
Do you mean this?
Code:
INNER JOIN PS_GameData.dbo.UserMaxGrow
ON (PS_GameData.dbo.UserMaxGrow.UserUID = PS_GameData.dbo.Chars.UserUID)
WHERE PS_GameData.dbo.UserMaxGrow.Country=1;
If that's what you mean that it is totally unnecessary. This part of the script completely replaces that.
Code:
	CASE
	WHEN Family IN (0,1) THEN 'L-*'
	WHEN Family IN (2,3) THEN 'F-*'
Family IN (0,1) -- (Human,Elf)
Family IN (2,3) -- (Deatheater, Vile)
05/20/2016 03:05 THEXxmateo#6
Quote:
Originally Posted by wallerus View Post
Do you mean this?
Code:
INNER JOIN PS_GameData.dbo.UserMaxGrow
ON (PS_GameData.dbo.UserMaxGrow.UserUID = PS_GameData.dbo.Chars.UserUID)
WHERE PS_GameData.dbo.UserMaxGrow.Country=1;
If that's what you mean that it is totally unnecessary. This part of the script completely replaces that.
Code:
	CASE
	WHEN Family IN (0,1) THEN 'L-*'
	WHEN Family IN (2,3) THEN 'F-*'
Family IN (0,1) -- (Human,Elf)
Family IN (2,3) -- (Deatheater, Vile)
Ahh I understand Thanks!
05/20/2016 13:55 MC Flip#7
Since adding tags is not something you do every day (or at least shouldn't do if you're running a serious server), you can always go the a bit more complex, but still simple, way of achieving this. Simpler than figuring out why pre-made querries don't work for you.

If you want to tag specific characters (eg. GameSages), use this:

Code:
SELECT * FROM PS_GameData.dbo.Chars
WHERE CharName='INSERTCHARNAMEHERE'
This will display you all the characters data in the Chars.dbo, but you will not be able to simply edit the results (you can, with a more advanced querry).
Simply open the Chars.dbo and look for the character you want to edit, based on the CharID or UserID, whichever is easier for you.