我想检索给定的Sql Server数据库中的所有模式的列表.使用ADO.NET模式检索API,我得到了所有集合的列表,但没有"模式"的集合.我可以穿越'Tables','Procedures'(如果需要和其他人)的集合,并获得独特的架构名称列表,但不存在实现相同结果的更简单/短呢?
示例:对于标准'AdventureWorks'数据库,我也想获得以下列表 - dbo,HumanResources,Person,Production,Purchasing,Sales(我省略了其他标准的Schem名称,如db_accessadmin,db_datareader等)
编辑:我可以通过查询系统视图获取模式列表 - INFORMATION_SCHEMA.SCHEMATA但更喜欢使用模式API作为首选.
我有一个名为Employee的表
Eno ename AttributeValue AttributeName
1 aa a123 abc
2 bbb b123 dcf
3 cc c7sd wew3
Run Code Online (Sandbox Code Playgroud)
我希望将数据从交换柱AttributeValue到AttributeName和AttributeName到AttributeValue
例如:
Eno ename AttributeValue AttributeName
1 aa abc a123
2 bbb dcf b123
3 cc wew3 c7sd
Run Code Online (Sandbox Code Playgroud) 什么是系统表master..spt_values的目的是什么?
为什么提供它以及如何使用它?
它的类型,低值,高值的含义是什么?
更新:
Google搜索提供了数千个"其用途",例如:
一些帖子警告它的使用,因为它可以在SQL Server的未来版本中删除,但已经有代码脚本使用它来说明新SQL Server 11(Denali)的新功能:
我有这样的SQL查询;
SELECT *
FROM Jira.customfieldvalue
WHERE CUSTOMFIELD = 12534
AND ISSUE = 19602
Run Code Online (Sandbox Code Playgroud)
这就是结果;

我想要的是; 显示在一行(单元格)中的所有组合,STRINGVALUE并用逗号分隔.像这样;
SELECT --some process with STRINGVALUE--
FROM Jira.customfieldvalue
WHERE CUSTOMFIELD = 12534
AND ISSUE = 19602
Araç Listesi (C2, K1 vb.Belgeler; yoksa Ruhsat Fotokopileri), Min. 5
araç plakas? için ?nternet Sorgusu, Son 3 Y?la Ait Onayl? Y?l Sonu
Bilanço + Gelir Tablosu, Son Y?l (Y?l Sonuna ait) Detay Mizan?, ?çinde
Bulundu?umuz Y?la ait Ara Dönem Geçici Vergi Beyannamesi, Bayi Yorum
E-Maili, Proforma Fatura …Run Code Online (Sandbox Code Playgroud) 我正在尝试跟踪Microsoft Server中的一些SQL.我遇到了一个使用我不熟悉的约定的联接." =*"是什么意思?
WHERE table1.yr =* table2.yr -1
Run Code Online (Sandbox Code Playgroud) 请问任何人可以区分什么是最好使用SQLite或SQL Server?我使用XML文件作为数据存储ADD,删除,更新..有人建议使用SQLite进行快速操作,但我不熟悉SQLite,我知道SQL Server.
我被分配将数据库迁移到中产阶级ERP.新系统在这里和那里使用复合主键,从实用的角度来看,为什么?
与自动生成的ID相比,我只能看到消极方面;
它正在回归到候选键的设计概念,我没有看到它的意义.
它是软盘日的习惯/神器(最小化空间/索引),还是我错过了什么?
//编辑//刚发现好的SO帖子:复合主键与唯一对象ID字段 //
我目前正在尝试备份我为一个暂时搁置的项目设计的空SQL Server 2008 R2数据库.当我注意到有一个选项可以复制备份时,我正在通过SQL Management Studio进行备份过程.我仔细查看它是什么,但我没有完全理解我得到的选项.
http://technet.microsoft.com/en-us/library/ms191495.aspx
我阅读了上面的条目以及其他条目,我一直看到"独立于传统SQL Server备份序列"这一短语.
任何人都可以详细说明这个声明对一般复制备份的意义或更多内容吗?我不确定这是否是我应该做的备份?(我的第一反应是否定的)
为了在数据库中插入大量数据,我曾经将所有插入信息收集到列表中并将此列表转换为a DataTable.然后我通过将该列表插入数据库SqlBulkCopy.
我发送生成的列表LiMyList
,其中包含我要插入数据库的所有批量数据的信息,并将其
传递给我的批量插入操作
InsertData(LiMyList, "MyTable");
Run Code Online (Sandbox Code Playgroud)
哪里InsertData是
public static void InsertData<T>(List<T> list,string TableName)
{
DataTable dt = new DataTable("MyTable");
clsBulkOperation blk = new clsBulkOperation();
dt = ConvertToDataTable(list);
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
using (SqlBulkCopy bulkcopy = new SqlBulkCopy(ConfigurationManager.ConnectionStrings["SchoolSoulDataEntitiesForReport"].ConnectionString))
{
bulkcopy.BulkCopyTimeout = 660;
bulkcopy.DestinationTableName = TableName;
bulkcopy.WriteToServer(dt);
}
}
public static DataTable ConvertToDataTable<T>(IList<T> data)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
DataTable table = new DataTable();
foreach (PropertyDescriptor prop in properties)
table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
foreach (T item in data) …Run Code Online (Sandbox Code Playgroud) 我得到了这个例外:
参数化查询'(@ Name nvarchar(8),@ type nvarchar(8),@ units nvarchar(4000),@ rang'需要参数'@units',这是未提供的.
我的插入代码是:
public int insertType(string name, string type, string units = "N\\A", string range = "N\\A", string scale = "N\\A", string description = "N\\A", Guid guid = new Guid())
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand();
command.CommandText = "INSERT INTO Type(name, type, units, range, scale, description, guid) OUTPUT INSERTED.ID VALUES (@Name, @type, @units, @range, @scale, @description, @guid) ";
command.Connection = connection;
command.Parameters.AddWithValue("@Name", name);
command.Parameters.AddWithValue("@type", type); …Run Code Online (Sandbox Code Playgroud)