从数据库中以字符串格式文本检索表名
我有一个这样的查询,
@"SELECT
TABLE_NAME
AS
TABLES
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE
CONSTRAINT_TYPE = 'PRIMARY KEY'
AND
TABLE_NAME <> 'dtProperties'
ORDER BY
TABLE_NAME";
当从此查询中检索表列表时,有什么方法可以将表格形式转换为字符串格式形式。
I have a query like this
@"SELECT
TABLE_NAME
AS
TABLES
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE
CONSTRAINT_TYPE = 'PRIMARY KEY'
AND
TABLE_NAME <> 'dtProperties'
ORDER BY
TABLE_NAME";
Is there any way to convert the tabular form to string formatted form when retrieving list of tables from this query.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过 .NET,两者都不是 - 这只是 SSMS 显示。根据前面的问题,听起来您只是很难将本专栏读成字符串;
也许只是这样的东西:(
在本地测试;工作正常)
如果您想要分隔的东西,那么也许:
或者涉及
StringBuilder
的东西(本例中的换行符):Via .NET it is neither - that is just the SSMS display. Based on the previous questions, it sounds like you are just having difficulties reading this column into strings;
Perhaps just something like:
(tested locally; works fine)
If you want something delimited, then perhaps:
Or something involving a
StringBuilder
(newlines in this example):这样的事情有帮助吗?
Something like this helps?
我不知道你所说的格式化表格是什么意思。
您可以使用以下 sql 语句检索包含所有表名称的字符串:
I don't know what you mean with formatted form.
You can retrieve a string with all table names with following sql statement: