Tag Info

New answers tagged

4

So it's an indexed view - SQL Server can automatically choose to use an indexed view if the base table is referenced and the indexed view can (better) satisfy the query. From MSDN (emphasis mine): A query does not have to explicitly reference an indexed view in the FROM clause for the query optimizer to use the indexed view. If the query contains ...


0

More than likely, you have not promoted the views to be production views. When views are "development" views they will only select a very small subset of data for efficiency purposes. Once they are promoted to production and gather everything, then they will actually see the entire data set. At this time, there is no way to span buckets with views in ...


0

This is a known issue with SQL Server 2012. It used to work in previous versions. The Microsoft Connect item can be found here: https://connect.microsoft.com/SQLServer/feedback/details/769502/permissions-not-replicating-for-certain-object-types-when-using-a-sql-server-2012-distributor We first noticed it on the MSDN Forums here: ...


3

This is a bug, fixed in the July 2014 CPU - See Oracle Support document 1666884.1. Easily reproduced with the following: create view v1 as ( select 'view' as vvv from dual ); create view v2 as ( select * from v1 ); with v1 as ( select 'cte' as vvv from dual) select * from v2;


1

You could use a DDL trigger to print the output of the object that was affected, or you could use the trigger to automatically log the change in an audit table so that you can view DDL change history. Here is an example http://www.mssqltips.com/sqlservertip/2085/sql-server-ddl-triggers-to-track-all-database-changes/


2

Use :on error exit and/or -b. This will cause sqlcmd to exit after the first batch that hits and error, and set the %ERRORLEVEL%: -b Specifies that sqlcmd exits and returns a DOS ERRORLEVEL value when an error occurs. The value that is returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity level greater than ...


3

Check sys.objects for the row that has the right value in name and see if the modify_date column is newer than when your script started. SELECT SYSDATETIME() AS ScriptStart INTO #scriptstart; GO ALTER VIEW ... GO ALTER PROC ... GO SELECT name FROM sys.objects WHERE modify_date > (SELECT ScriptStart FROM #scriptstart); This will list all the objects ...


1

May be this example ,will help you: ALTER VIEW dbo.vTest AS SELECT TOP(10) ProductName FROM [dbo].[TestData] GO IF @@ERROR <> 0 print 'ERR' ELSE print 'ok' GO ALTER VIEW dbo.vTest AS SELECT TOP(10) PoductName FROM [dbo].[TestData] GO IF @@ERROR <> 0 print 'ERR' ELSE print 'ok' GO And instead of printing the message, ...



Top 50 recent answers are included