Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql Server数据库名称存在小数点,执行SqlServerDbFirst报错 #18

Closed
LambertW opened this issue Mar 16, 2019 · 5 comments
Closed

Comments

@LambertW
Copy link
Contributor

可创建数据库 Test.DB,
_sqlserverFixture.SqlServer.DbFirst.GetTablesByDatabase("Test.DB");
就能重现此问题。

@LambertW
Copy link
Contributor Author

use {db};
没有包裹[Test.DB]引起~

@2881099
Copy link
Collaborator

2881099 commented Mar 16, 2019

我是设计能支持多库,如果在内里[Test.DB],就不能跨库或者跨Schema使用了。

@LambertW
Copy link
Contributor Author

GetTablesByDatabase为例,如何实现支持多库?不太理解。

use {db};
select 
 a.Object_id
,b.name 'Owner'
,a.name 'Name'
,'TABLE' type
from sys.tables a
inner join sys.schemas b on b.schema_id = a.schema_id
where not(b.name = 'dbo' and a.name = 'sysdiagrams')
union all
select
 a.Object_id
,b.name 'Owner'
,a.name 'Name'
,'VIEW' type
from sys.views a
inner join sys.schemas b on b.schema_id = a.schema_id
union all
select 
 a.Object_id
,b.name 'Owner'
,a.name 'Name'
,'StoreProcedure' type
from sys.procedures a
inner join sys.schemas b on b.schema_id = a.schema_id
where a.type = 'P' and charindex('$NPSP', a.name) = 0 and charindex('diagram', a.name) = 0
order by type desc, b.name, a.name
;
use {olddatabase};

@2881099
Copy link
Collaborator

2881099 commented Mar 16, 2019

看错了,确实有要加[],我处理一下,谢谢

@2881099
Copy link
Collaborator

2881099 commented Apr 8, 2019

问题已修复,忘了回复。

@2881099 2881099 closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants