Developer forum

Forum » CMS - Standard features » SQL Firehose - strings concatenation

SQL Firehose - strings concatenation

Sergey Kalinin
Reply

Hi

Is it possible to concatenate strings variables in the firehose editor?

I have an error when i try to use + operator to concatenate 2 strings and if i try to use CONCAT function have a message that it is not recognized as standard function

is there any other way to do this?

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Sergey

You shoulde be able to do like this:

SELECT * FROM area where areaid = CONCAT('1', '')

 
Sergey Kalinin
Reply

And how could i do something like this: 

 

DECLARE @variantId NVARCHAR(4)
SET @variantId='VO16'

DECLARE @variantName NVARCHAR(100)

SET @variantName = 'VariantName'

SELECT CONCAT(@variantId, @variantName)

I have an error (in attachment)

 

 

111.PNG
 
Nicolai Høeg Pedersen
Reply

Hm, it works in my Firehose, see dump.

Could it be that your solution has a really old Database server, old database level, missing settings, missing permissions or someting similar - can you execute the query directly on your database?

BR Nicolai

Capture.PNG
 
Sergey Kalinin
Reply

Hi Nicolai,

 have a solution hosted on dynamicweb-cms.com so i don't have direct access to my database

 

 
Nicolai Høeg Pedersen
Reply

Can you give me a link?

 
Sergey Kalinin
Reply

http://danskadelsforening.net.dynamicweb-cms.com/

by the way, could it depend on a browser? because i've tried it only in Chrome

 
Nicolai Høeg Pedersen
Reply

Hi Sergey

This solution is hosted on SQL 2008 - the concat function is available in 2012+:

https://msdn.microsoft.com/en-us/library/hh231515%28v=sql.110%29.aspx

You can only Concatenate using +  in 2008

 
Sergey Kalinin
Reply

I've tried to execute the same query but without CONCAT  - the last string is

SELECT @variantId + @variantName

on sql server v. 2008 r2 and it does work but it doesn't work on Firehose: i have another error (in attachment) and if i just remove "+ @variantName"  - all works as it should. 

111.PNG
 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Sergey

Yes, that is because SQL server 2008 does not support concatenating variables... Cannot do anything about it.

BR Nicolai

Votes for this answer: 1
 
Sergey Kalinin
Reply

Thank you for your help!

 

You must be logged in to post in the forum