[英]Special Characters in SQL Stored Procedures
I am concatenating four columns in my query and using this concatenated string for display.我在我的查询中连接四列并使用这个连接的字符串进行显示。 The problem is I want to separate the data from the 4 columns with '-' (a hyphen).
问题是我想用“-”(连字符)将数据与 4 列分开。 But SQL throws an error.
但是 SQL 会抛出错误。 Suggestions?
建议?
Could do with viewing the SQL you are using as per the comments, but the below may help.可以根据评论查看您正在使用的 SQL,但以下内容可能会有所帮助。 If not I will delete.
如果没有我会删除。
DECLARE @WORD1 VARCHAR(10)
DECLARE @WORD2 VARCHAR(10)
DECLARE @WORD3 VARCHAR(10)
DECLARE @WORD4 VARCHAR(10)
SET @WORD1 = 'The'
SET @WORD2 = 'cat'
SET @WORD3 = 'and'
SET @WORD4 = 'dog'
SELECT @WORD1 + '-' + @WORD2 + '-' + @WORD3 + '-' + @WORD4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.