Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Richard McClay
58
Views
2
Comments
Creating a SQL function
Question
SQL
Logic
Hi,
I need to call the below function in a subsequent Advanced Query - how can I best create the function? Is it possible through the Outsystems front end or does it need to be written directly to the SQL server. I would greatly appreciate any advice you could pass on.
Many thanks,
Richard
CREATE FUNCTION dbo.Split ( @String VARCHAR(
8000
), @Delimiter NVARCHAR(
1
))
RETURNS @Tokens table
(
Token NVARCHAR(
255
)
)
AS
BEGIN
WHILE (CHARINDEX(@Delimiter,@String)>
0
)
BEGIN
INSERT INTO @Tokens (Token) VALUES (LTRIM(RTRIM(SUBSTRING(@String,
1
,CHARINDEX(@Delimiter,@String)-
1
))))
SET @String = SUBSTRING(@String,
CHARINDEX(@Delimiter,@String)+LEN(@Delimiter),LEN(@String))
END
INSERT INTO @Tokens (Token) VALUES (LTRIM(RTRIM(@String)))
RETURN
END
GO
Kilian Hekhuis
MVP
Hi Richard,
The platform does not support this. You'll have to create it using the appropriate database tools. Be sure that the function is created in a way that the Outsystems database user can access it.
Pedro Coelho
MVP
Actually the plataform does support this IF you provide the runtime database user the appropriate rights, which is not a good security policy, and that is why it's not on the runtime user's privileges to start with.
Anyway if your requirements don't include create functions that may have their code changed in time, the best approach is, as Kilian said, to do it with the appropriate database tools, preferably in the
dbo
schema of the plataform database.
Best regards,
PC
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...