我正在使用一个在SQL Server 2005上运行良好的Openquey,我有一台服务器是SQL Server 2008,但这不起作用.
如果我运行以下内容:
SELECT *
FROM OPENQUERY([Manchester],
'[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance ''10/01/2009'',
''10/10/2009''')
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Cannot process the object "[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance '10/01/2009', '10/10/2009'".
The OLE DB provider "SQLNCLI" for linked server "Manchester" indicates that either the object has no columns or the current user does not have permissions on that object.
Run Code Online (Sandbox Code Playgroud)
如果我只是运行:
[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance '10/01/2009', '10/10/2009'
Run Code Online (Sandbox Code Playgroud)
它工作正常.2008年发生了什么变化?
它的作用是从openquery获取数据并插入到我的临时表中:
INSERT #TempHandheldPerformance SELECT * FROM OPENQUERY([Manchester], '[Manchester].PilotWebApp.DBO.rsp_HandheldPerformance ''10/01/2009'', ''10/10/2009''')
Run Code Online (Sandbox Code Playgroud) 我想将SALES多维数据集重命名为SALES_2009并添加一个名为SALES的新多维数据集.当我重命名它时,ID仍然是SALES,因此我的新立方体现在称为SALES,但它的内部ID是SALES_2010(我的旧立方体称为SALES_2009,但内部ID是SALES).
可以更改SSAS数据库的ID吗?
我已经尝试了属性窗口和googled bing,但无济于事.
我刚刚将数据库从SQL 2000实例移动到SQL 2008实例,并遇到了一个奇怪的问题,它似乎与IDENTITY列和存储过程有关.
我在数据库中有许多存储过程
create procedure usp_add_something @somethingId int, @somethingName nvarchar(100)
with encryption
as
-- If there's an ID then update the record
if @somethingId <> -1 begin
UPDATE something SET somethingName = @somethingName
end else begin
-- Add a new record
INSERT INTO something ( somethingName ) VALUES ( @somethingName )
end
go
Run Code Online (Sandbox Code Playgroud)
这些都是作为ENCRYPTED存储过程创建的.id列(例如本例中的somethingId)是一个IDENTITY(1,1),上面有一个PRIMARY KEY,这些表中有很多行.
恢复到SQL 2008实例后,很多我的数据库似乎工作正常,但调用如
exec usp_add_something @somethingId = -1, @somethingName = 'A Name'
Run Code Online (Sandbox Code Playgroud)
导致如下错误:
Violation of PRIMARY KEY constraint 'Something_PK'. Cannot insert duplicate key in object …
我正在寻找一种简单(如果可能的话)最简单的备份和恢复数据库的方法.
我想在一个状态下进行备份,然后在执行某些操作后返回到备份状态.
尝试数据库 - >任务 - >备份...然后数据库 - >任务 - >恢复,但我总是得到一个错误:
Restore failed for...DBName
The tail of the log for the database "database name" has not been backed up...
所以,我想通过一个简单的操作备份和恢复每个,可以建议我一个解决方案,无论是GUI还是不基于GUI?
当我在Visual Studio中打开XSD文件时,其中一些文件以图表形式打开,而另一些则作为代码打开.
如何在图表视图和代码视图之间切换?
我有两个表,名为t_master和t_detail.
t_detail表中的数据对应于主表上的记录.
t_master的数据
ID Brand
1 Toyota
2 Honda
Run Code Online (Sandbox Code Playgroud)
t_detail的数据
DetID ParentID Model
1 1 Corolla 2009
2 1 Corolla 2010
3 1 Corolla 2011
4 2 Civic 2004
5 2 Civic 2006
Run Code Online (Sandbox Code Playgroud)
现在,我想创建一个查询,该查询应该选择主表中的所有行,同时选择具有最新ID(最大)的详细信息,即
ID Brand DetID ParentID Model
1 Toyota 3 1 Corolla 2011
2 Honda 5 2 Civic 2006
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助.谢谢.
我正在使用Oracle SQL Developer.
我正在使用参数 &TableName
我的查询在结果中返回给我,在它之前有一个OLD:标签,并且再次使用New:标签(变量被我输入的值替换)然后我的结果如下.
如何摆脱这个令人讨厌的回报并将其更改为仅显示我的结果?
我正在权衡两者之间的差异
If[condition1 AND condition2, A, B]
Run Code Online (Sandbox Code Playgroud)
和
If[condition1, If[condition2, A, B], B]
Run Code Online (Sandbox Code Playgroud)
我的想法:嵌套的IF会更快.
我的理由是:通过嵌套的IF,条件2只计算在条件1为真.在我正在做的事情中,这意味着condition2评估次数将少于上面第一个选项.
AND是通常的逻辑"和"(当且仅当两个前提都为真时才为真).通过IF,我的意思是IF [ 条件,当条件为真时,条件为假].
我希望我的问题不是太不合适; 我确信有一些例子可以让第一个选项运行得更快.我只是希望一般情况确实如此.
谢谢.
这是我的OnClick事件:
protected void Submit_Click(object sender, EventArgs e)
{
try
{
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlCommand cmd = new SqlCommand("administratorUpdate", con))
{
cmd.Parameters.Add("@originalID", SqlDbType.VarChar).Value = IDHF.Value;
cmd.Parameters.Add("@firstName", SqlDbType.VarChar).Value = firstNameTB.Text;
cmd.Parameters.Add("@lastName", SqlDbType.VarChar).Value = lastNameTB.Text;
cmd.Parameters.Add("@userName", SqlDbType.VarChar).Value = userNameTB.Text;
cmd.Parameters.Add("@emailAddress", SqlDbType.VarChar).Value = emailAddressTB.Text;
cmd.CommandType = CommandType.StoredProcedure;
}
}
GetAllRPT.DataBind();
Label ErrorMessageLabel = (Label)Master.FindControl("ErrorMessageLabel");
new myFunctions().DisplayUserMessage("success", "Administrator Updated!", ErrorMessageLabel);
AdminForm.Visible = false;
}
catch (Exception ex)
{
Label ErrorMessageLabel = (Label)Master.FindControl("ErrorMessageLabel");
new myFunctions().DisplayUserMessage("error", ex.Message, ErrorMessageLabel);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的存储过程[administratorUpdate]:
ALTER …Run Code Online (Sandbox Code Playgroud) 我有2个数据库.... a&b
我在这两个数据库中都有表"t".
现在我从数据库"b"中删除表t.
我在数据库"b"中创建了一个视图"t"(参见视图的名称与删除的表相同)...这个视图引用了数据库"a"中的表"t".
我有一个dotnet应用程序..它指向数据库"b".它有内联查询....所以我可以在内联查询中保留像"bt"这样的引用.我的意思是现在它会引用视图"t"而不是表"t"?