我正在使用SQL 2000,我在一个包含大约3000万行的表上运行一个简单的select语句.选择查询如下所示:
select col1, col2, col3 from Table1 where col4=@col4 and col5=@col5 and col6=@col6
Run Code Online (Sandbox Code Playgroud)
该表中有一个聚簇索引(即一个主键),但它没有被用作where标准.上面提到的所有标准都没有索引.
如何优化此查询?
如果我在where子句中为每列添加索引,那会有什么不同吗?
如果我在where子句中有10列,那么这10列中的所有列都应该有索引吗?
编辑:这可能是最常见的面试问题之一:)
我正在将文件加载到byte []中.根据我的理解,byte []应包含特定的字节元素(8位).当我打印每个字节时,它们都不是8位(即它们的长度不是8).我的代码:
FileStream stream = File.OpenRead(@"C:\Image\Img.jpg");
byte[] fileByte = new byte[stream.Length];
stream.Read(fileByte, 0, fileByte.Length);
for (int i = 0; i <= fileByte.Length - 1; i++)
{
Console.WriteLine(Convert.ToString(fileByte[i], 2));
}
Run Code Online (Sandbox Code Playgroud)
输出:
10001110
11101011
10001100
1000111
10011010
10010011
1001010
11000000
1001001
100100
Run Code Online (Sandbox Code Playgroud)
我认为我的理解在这里是错误的,你能告诉我(或提供一些教程链接)我错过了这个.
Windows Sharepoint Service和MOSS(Microsoft Office Sharepoint)之间有什么区别.如果我在我的机器上安装了WSS 3.0,我可以使用Sharepoint Designer和Inforpath创建一个sharepoint站点.那我为什么需要MOSS 2007(WSS 3.0可以免费下载).
insert into XYZ(col1, col2) values (1,2)
update XYZ set ... where col1 = 1
COMMIT
Run Code Online (Sandbox Code Playgroud)
正如在上面的代码中看到的,我们还没有提交我们的insert语句,我们在同一行上执行了更新操作,最后我们提交了整个批处理.
在这种情况下究竟会发生什么?在这种情况下是否有丢失数据的可能性?
我正在从我的C#代码创建一个XML文档.我需要在我的XML文档中添加XSL引用.我的代码是:
XmlDocument xDoc = new XmlDocument();
if (!File.Exists(fileName))
{
XmlDeclaration dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xDoc.AppendChild(dec);
**[Need to add code to add the XSL reference e.g. - <?xml-stylesheet type="text/xsl" href="style.xsl"?> ] **
XmlElement root = xDoc.CreateElement("Errors");
xDoc.AppendChild(root);
}
else
{
xDoc.Load(fileName);
}
XmlElement errorLogStart = xDoc.CreateElement("ErrorLog");
XmlElement errorText = xDoc.CreateElement("Message");
errorText.InnerText = message;
errorLogStart.AppendChild(errorText);
xDoc.DocumentElement.InsertBefore(errorLogStart, xDoc.DocumentElement.FirstChild);
FileStream fileXml = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
xDoc.Save(fileXml);
Run Code Online (Sandbox Code Playgroud)
我需要<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>在我的XML文档中添加以下行.我该怎么做?通过谷歌找不到多少.