I have a query that seems to take a while to execute and I'm looking into using an indexed view to see if this helps. I use the script below to create the view but when I query it's indexability using:
Here is a very cut down version of the view, only selects the uid! from a single table
IF OBJECT_ID ('GetMessageQueueDetails', 'view') IS NOT NULL
DROP VIEW GetMessageQueueDetails ;
GO
IF sessionproperty('ARITHABORT') = 0 SET ARITHABORT ON
IF sessionproperty('CONCAT_NULL_YIELDS_NULL') = 0 SET CONCAT_NULL_YIELDS_NULL ON
IF sessionproperty('QUOTED_IDENTIFIER') = 0 SET QUOTED_IDENTIFIER ON
IF sessionproperty('ANSI_NULLS') = 0 SET ANSI_NULLS ON
IF sessionproperty('ANSI_PADDING') = 0 SET ANSI_PADDING ON
IF sessionproperty('ANSI_WARNINGS') = 0 SET ANSI_WARNINGS ON
IF sessionproperty('NUMERIC_ROUNDABORT') = 1 SET NUMERIC_ROUNDABORT OFF
GO
CREATE VIEW GetMessageQueueDetails
WITH SCHEMABINDING
AS
SELECT Uid
FROM dbo.MyTable
GO
I see from See http://msdn.microsoft.com/en-us/library/aa933148(SQL.80).aspx that the pre-requsites for indexed views are pretty strict, I have been through this list and think I have everything covered, except for :
"The ANSI_NULLS option must have been set to ON for the execution of all CREATE TABLE statements that create tables referenced by the view."
Is there an easy way to find out if ANSI_NULLS was ON or OFF when the table was created. If it was OFF can I do an ALTER TABLE to turn it on and will that make the view indexable? If so how do I do this with out trashing the data in the table?
Hi,I have an application that's running fine on development servers (weband database-sql server 2000). I'm updating a record through a thirdparty component but I don't think the component is the problem. What'shappening is that I'm updating fields that are part of view. I'm onlyupdating fields in one table of the view and this works fine in thedevelopment environment.What happens in the production environment when I try to update(using the third party component) I get the following message:"Current recordset does not support updating. This may be a limitationof the provider or of the selected locktype."As an experiment I took the same code but removed the view, leavingonly the table I want to update as the record source. In that case theupdate worked. So it seems that something in the production databasedoesn't like me updating a view. However I can do that in the databasein the development environment.The third party component is dbnetgrid which works fine in thedevelopment environment. I can only conclude it's something about thedatabase that prevents me from updating this same table if it's in aview. I've talked to our DBA but he says there's no difference betweenthe databases. Any ideas would be appreciated.Neil
Select order_NO, shiptoname, Shiptoaddress, Shiptocity,shiptostate, shiptozip, EMAILaddress FROM orders;
my question is: If the email exist in the EMAILaddress column then I need to have a Y show in another column called EMAILflag, if the EMAILaddress does not exist then I would need the EMAILflag to be a N.
I'm trying to set up a transactional replication from SQl Server 2005 to SQl server 2000. The Distributor and the publisher are on our server and the subscription is supposed to be on a SQL 2000 server on a different location. Before upgrading to 2005 I didn't have problems - the replication from 2000 to 2000 was working perfectly.
After I succesfully created the distributor and the publication the first problem that I encountered was that when I tried to create the subscription it was giving me an error that I cannot use an IP to acces the server. I realized to fix that issue by creating an Alias in the SQL Server Configuration Manager for the server where I wanted to create the subscription (a push subscription).
Now when I try to add the subscriber it gives me another message "Execute permission denied on object 'sp_MS_replication_installed', database 'master', owner 'dbo'" - so I cannot create the subscriber.
The user that I use to create the subscriber on the 2000 server is dbo for the subscriber database but it doesn't have rights on the master database. Also I realized that on the 2000 server I still have the old subscription but I cannot delete it - for the same reason - no access on the master database. Before upgrading to 2005 I had the exact same rights on the 2000 server.
Write a CREATE VIEW statement that defines a view named Invoice Basic that returns three columns: VendorName, InvoiceNumber, and InvoiceTotal. Then, write a SELECT statement that returns all of the columns in the view, sorted by VendorName, where the first letter of the vendor name is N, O, or P.
This is what I have so far,
CREATE VIEW InvoiceBasic AS SELECT VendorName, InvoiceNumber, InvoiceTotal From Vendors JOIN Invoices ON Vendors.VendorID = Invoices.VendorID
I'm trying to create a proc for granting permission for developer, but I tried many times, still couldn't get successful, someone can help me? The original statement is:
I had given one of our developers create view permissions, but he wants to also modify views that are not owned by him, they are owned by dbo.
I ran a profiler trace and determined that when he tries to modify a view using query designer in SQLem or right clicks in SQLem on the view and goes to properties, it is performing a ALTER VIEW. It does the same for dbo in a trace (an ALTER View). He gets a call failed and a permission error that he doesn't have create view permissions, object is owned by dbo, using both methods.
If it is doing an alter view how can I set permissions for that and why does it give a create view error when its really doing an alter view? Very confusing.
When I try to do a pull using a view I'm getting the following error message:
€œThe query cannot be tracked. There might not be a primary key, or the query might involve multiple tables. [ Query string = SELECT * FROM DATABASE_NAME.viewname ]€?
but when I do a select col1 from view I get my data. The view has some inner joins included in it, could that be the issue?
NOTE: this is from my handheld device, its not SQL Server related. I posted this earlier in this forum but it was moved to SQL Server.
I get the error on my handheld device and handheld device only
When I try to do a pull using a view I'm getting the following error message:
€œThe query cannot be tracked. There might not be a primary key, or the query might involve multiple tables. [ Query string = SELECT * FROM DATABASE_NAME.viewname ]€?
but when I do a 'select col1 from viewname' I get my data. The view has some inner joins included in it, could that be the issue?
I have some issue when replicating a view (transactional replication).I have following objects on publisher:
Table: [Metadataschema].[Entity] View: [dbo].[EntityLogicalView] the view definition is:
create view [dbo].[EntityLogicalView] as (SELECT * FROM [Entity] WHERE OverwriteTime = 0)
this is what I get when I run "Script View as Create". The same query is used by the replication.Unfortunately this query fails on the subscriber "Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber". I cannot even runt his query manually on the subscriber, it only works when I change it like this:create view [dbo].[EntityLogicalView] as (SELECT * FROM [Metadataschema].[Entity] WHERE OverwriteTime = 0) Is there any way to get this working? Can I change the creation scripts used by the replication or force publisher to include schema names in all objects?
I am creating a simple application form using visual studio 2015. I can create database.mdf successfully and create dbo.table successfully. but when i tried to view table by expanding the table icon on the server explorer, the table should be able to show list of table but it didn't show any record and why is it like that.
We have a maintenance plan in place for updating the statistics on daily basis. Now, i would like to remove the view from maintenance plan. How can i remove that from Update statistics task?
I have couple of Web pages linking to my RDLs using report viewer Web controls. I have no problem running and viewing them in VS2005 debug mode and report manager until I published them to local folder and set the local folder as an application on my IIS7. When running the published version of the Web pages, all my calendar image buttons (which happen to be part of the report parameter fields) turned to red 'X':
When clicking the View Report button, the animated progress icon not appearing at all. Before the occurance of this problem, I did face the problem whereby the 'NT AUTHORITYNETWORK SERVICE' does not have enough permission to view the report. After referring to some threads, I finally be able to get rid of this error by assigning Browser role to 'NT AUTHORITYNETWORK SERVICE' from the report manager. I wonder could this solution be related to the problem that I'm facing now. Any help would be appreciated.
Technically they should be able to view and modify jobs through Management Studio when being added only to SQLAgentOperatorRole. However they receive the following error when clicking on the Jobs folder regardless of the msdb role.
Our original two SQL 2005 servers do not produce this message, but all other instances do. All servers, but one, are SP2 so the service pack is not an issue. Any thoughts?
Hi, I need urgent help with this problem because I am unable to do any database development due to it. I am using visual web developer express edition with sql server 2005 express edition. The problem is that when I try to create a database in the app_data folder I get the following error message: "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed". Regards, sandy
I'm running SQL Server 2002 and trying to create a User Defined Function. However, everytime I try to save the script I get Error 170 Incorrect Syntax near 'FUNCTION'.
This happens if I create the Function from Code or use the Enterprise Manager. I'm logged in with 'sa' privs, so I don't think it's a privilege issue. I'm well confused.
I was asked to import some data from excel into a table within a sqlserver 2000 db the import was complaining about an index so then I deleted the index imported the data succesfilly but I'm now unable to re create the index, please see the error that I'm getting below. Can someone please help. Thanks
- Unable to create index 'trainingGo'. ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 32. Most significant primary key is '439'. [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.
I had a fully functioning SQL 2005 Exp install until today. All of my DBs work, Reporting Services works. But today I went to add a new DB for a DotNetNuke installation. Everything I have tried fails with the same error:
***************************************************** TITLE: Microsoft SQL Server Management Studio Express ------------------------------ Create failed for Database 'TEST'. (Microsoft.SqlServer.Express.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476 ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo) ------------------------------ A file activation error occurred. The physical file name 'G:TEST.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation. CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 5105) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=5105&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------ *****************************************************
I have looked high and low for a solution only to come up empty handed. I only hope at this moment that someone here has seen this before.
Hi. I get this error when i try to create a relationship in a db diagram (sql 2005) "'tblActivedir' table saved successfully 'tblClient' table - Unable to create relationship 'FK_tblClient_tblActivedir1'. Introducing FOREIGN KEY constraint 'FK_tblClient_tblActivedir1' on table 'tblClient' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint. See previous errors."
What i have is 2 tables. 1 named client 1 named activedir
In the client table the columns i want to bind with activedirtable are FR1 and DC1 I want to bind them in the ID of the activedir table (both, in different fk relationships) so that they get the id of activedir. Fr1 has an fk relationship with activedir (pk is activedir' id) and DC1 exactly the same in another fk. So i want both columns to comunicate with activedir. If p.e. activedir has 3 elements (a,b,c) when i delete element a then werever FR1 or DC1 have this element(binded to it's id) then the element will also be deleted (id of the element) from both FR1 and DC1 I don't want to set Delete and Update action to none because i want the element changed or deleted from activedir, to do the same on Fr1 or DC1 or both. Any help? Thanks.
I need to create a new web site in Internet Information Service.
This can be done by opening IIS manager.
In IIS Manager, expand the local computer, right-click the Web Sites folder, point to New, and then click Web Site. The Web Site Creation Wizard appears.
But if i right click the Web Site Folder. only Properties and Refresh option is showing.New option is not shown.
I will appreciate if any one give solution to solve this problem.
I have two different sql servers one two different domains connected by internet. Iam working on Doman-A. Both sql server's are 2005
Domain Name System Name Sql Instance Name Port No
Domain-A SysA(IP:202.187.65.124) SqlA 1215
Domain-B SysB(IP:102.45.68.125) SqlB 1465
Intially I was unable to connect from SysA to SysB through sql management studio. But after giving the connection string as 102.45.68.125SqlB,1465 I was able to connect. Now my main problem is with the replication only. I had configured Publisher and Distrbutor on SysA. I want the subscriber to be SysB. But when I try to configure the subscription in the New Subscription Wizard from SSMS installed on SysA and try to Configure the subscription I get the following error message:
TITLE: New Subscription Wizard ------------------------------
SQL Server replication requires the actual server name to make a connection to the server. Connections through a server alias, IP address, or any other alternate name are not supported. Specify the actual server name, 'SysBSqlB'. (Replication.Utilities)
I've recently installed VB Express and SQL Server Express (including Management Studio Express) on a laptop as well as a desktop PC. Everything looks the same on both. I can create an SQL database from VB without any problems on my laptop. However, when I try to create a new SQL database from VB on my desktop, I get the following message:
"Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."
I've written a number of databases in Access, but never used SQL Server. This is about to drive my crazy.
Hello, I just recently installed SQL Express 2005 on a new OS which is on Vista Ultimate. When I try to attach a database by clicking the add button, I receive this error: =================================== Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum) ------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476 ------------------------------Program Location: at Microsoft.SqlServer.Management.Smo.Enumerator.Process(Object connectionInfo, Request request) at Microsoft.SqlServer.Management.SqlManagerUI.BrowseFolderHelper.GetBrowseStartPath(ISettingsStorage settingsStorage, ServerConnection serverConnection, Type controlType, String settingKey) at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.GetStartPath(String settingName) at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.buttonBrowse_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) =================================== An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo) ------------------------------Program Location: at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecuteSql.ExecuteImmediate(String query) at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm) at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillData(ResultType resultType, StringCollection sql, Object connectionInfo, StatementBuilder sb) at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType) at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result) at Microsoft.SqlServer.Management.Smo.SqlObjectBase.GetData(EnumResult erParent) at Microsoft.SqlServer.Management.Smo.Environment.GetData() at Microsoft.SqlServer.Management.Smo.Environment.GetData(Request req, Object ci) at Microsoft.SqlServer.Management.Smo.Enumerator.GetData(Object connectionInfo, Request request) at Microsoft.SqlServer.Management.Smo.Enumerator.Process(Object connectionInfo, Request request) =================================== The server principal "MyComputerKarl" is not able to access the database "model" under the current security context. (.Net SqlClient Data Provider) ------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=916&LinkId=20476 ------------------------------Server Name: MyComputerSQLEXPRESSError Number: 916Severity: 14State: 1Line Number: 1 ------------------------------Program Location: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
When I try to creat a new database I receive this error: =================================== Create failed for Database 'TestDB'. (Microsoft.SqlServer.Express.Smo) ------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476 ------------------------------Program Location: at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl() at Microsoft.SqlServer.Management.Smo.Database.Create() at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.ApplyChanges(Control marshallingControl) at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabase.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult) at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType) at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult) at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult) at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender) =================================== An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo) ------------------------------Program Location: at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImplFinish(StringCollection createQuery, ScriptingOptions so) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl() =================================== CREATE DATABASE permission denied in database 'master'. (.Net SqlClient Data Provider) ------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476 ------------------------------Server Name: MyComputerSQLEXPRESSError Number: 262Severity: 14State: 1Line Number: 1 ------------------------------Program Location: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) On my previous computer which had WinXp Pro I had no such problems Any Help would be much appreciated Thanks Karl
I tried to create a stored procedure but instead of opening up to a new stored procedure it displays an exist stored procedure. I erased the code and typed in my code now i received this error message.
MS SQL-DMO (ODBC SQLState:42000) Error 2729: Procedure ‘spUpdate_date_time’ group number 1 already exists in the database. Choose another procedure name
I just started having an issue with maintenance tasks. When I click on one of my jobs to modify it I get the following error. Also I am unable to create a new task unless I use the wizard? Could not load file or assembly 'msddsp, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (Microsoft.DataTransformationServices.Design)
Program Location:
at Microsoft.DataTransformationServices.Design.DtsComponentDiagram.CreateDdsView(Control parentControl) at Microsoft.DataWarehouse.Controls.DdsDiagramHostControl.set_ComponentDiagram(ComponentDiagram value) at Microsoft.DataTransformationServices.Design.DbMaintSequenceDesigner.get_DbMaintDiagramHost()
I am a complete newbie here. I have spent hours trying to create a database - (even installed on XP and Vista) and I seem to not be able to create a database - it tells me that:
Create Database permission denied in database master - Microsoft SQL Server Error 262.
How to I enable these priviledges?
Do i need to regsiter the Server with the Enterprise Manager and how do I do that?
I am running SQLServer 2000 SP3 with MDAC 2.8.On instances created via MSDE, I am unable to create the first step ina job. Instances created with SQLServer 2000, this problem does notoccur.The message I am receiving on the instances created with MSDE, themessage I get immediately upon pressing the Add button to define a stepis "Error 170: Line 1: Incorrect syntax near ''"Any help would would be greatly appreciated.Wardell Castles