不同的别名语法的含义及其对该别名行的字符长度输出的影响?

发布于 2025-02-13 20:08:20 字数 854 浏览 0 评论 0原文

使用Microsoft SQL Server Manager Studio (该片段是在某些列中搜索空白空间)

的使用:

sqlMPDD = REPLACE(MP.Scale, ' ', '?'))

我已告知: MPDD的结果行中 有时可以'有时'尽管该行只有10个字符,但作为标准;它显示了10个字符和许多空白空间。 (工具>选项>查询结果> sql server>结果text> gt; gt; max char of char of char in Char in Char in Char in Char in Char in Char of Char of Char disp of en Chare of Char of Char of Char of Char of Char of Char of Char of Char of Char of Char of Char of Char of Char of Char of Chare of Chod>

'mpdd'=替换(MP.Scale,',',','?')) 我知道您可以通过以下方式显示与结果行中的字符一样多的空间,

但您也可以通过:

MPDD = CONVERT(VARCHAR(10), REPLACE(MP.Scale, ' ', '?'))

但是,高级开发人员告诉我们,使用超过数十万个代码行的系统的功能过多,可以是放慢了太多功能。

对这个主题的任何洞察力,我将最感激,因为我在这个特殊区别上找不到任何东西。

Using Microsoft SQL server manager studio
(This snippet was to search for blank spaces in certain columns)

I have informed that the usage of:

sqlMPDD = REPLACE(MP.Scale, ' ', '?'))

Can 'sometimes', in the results row for MPDD show the "Maximum number of characters displayed in each column" which is set to 256 characters as standard despite that row only having 10 characters; it shows the 10 characters and a lot of blank space.
(Tools>Options>Query Results>SQL SERVER>RESULTS TO TEXT>Max No. of char disp in each col)

Whereas 'MPDD' = REPLACE(MP.Scale, ' ', '?'))
would display as many spaces as there are characters in the results row

I understand you can fix this by:

MPDD = CONVERT(VARCHAR(10), REPLACE(MP.Scale, ' ', '?'))

but am also told by a senior dev that too many functions with a system that runs thousands if not hundreds of thousands of lines of code can be slowed down by too many functions.

Any insight into this subject and I would be most grateful as I cannot find anything on this particular distinction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事和酒 2025-02-20 20:08:21

我已经阅读了您的问题4次,并且从我所要求的内容中读取了:“如何在使用SSMS中使用结果对文本选项进行返回结果中的特定列的列宽度”。

答案:

是,转换(varchar(10)....是解决方案

否,convert(varchar(10)....系统函数不会影响性能 的方式。

实用 href =“ https://blog.sqlauthority.com/2016/06/06/sql-server-server-vertical-select-mode-mode-mode-feature-sql-server-management-studio/”模式“它允许您一次编辑多行文本。这对于删除不中断空间的结果很有用 。

列 是的,他们可以放慢脚步。

I have read your question 4 times and from what I understand what you are asking is: "how to reduce column width of a specific column in returned results when using Results to Text option in SSMS".

Answer:

YES, CONVERT(VARCHAR(10) .... is the solution

AND

NO, CONVERT(VARCHAR(10) .... system function will not impact performance in a practical way.

Another useful feature in SSMS is "Vertical Block Select Mode" which allows you to edit multiple lines of text at once. This is useful for removing unnecesary white space in Result to Text columns.

RE "but am also told by a senior dev that too many functions with a system that runs thousands if not hundreds of thousands of lines of code can be slowed down by too many functions": you senior dev is talking about user defined functions. Yes they can slow things down.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文