SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.

learn more… | top users | synonyms (3)

1
vote
2answers
53 views

Can't create a table with the same name I deleted before

I started to use SQL Server recently and I think that its simple to resolve I did: 1 - Create table table_nome 2 - Drop table table_nome 3 - I'm trying to create a table with the same name, and ...
1
vote
1answer
32 views

linked servers between availability group to a server

I had three servers(server1, server2, server3) in availability group. And the listener name is "Production". I have a server name "Acceptance". I need to run a script that which will copy the tables ...
2
votes
1answer
41 views

SQL Server spatial geometry properties on index

Is there a way to add geometry.STSrid(object property) to a spatial index or is it already added when I create a spatial index in SQL Server 2012. I have mixed SRID table and I was wondering if it ...
5
votes
3answers
235 views

Shrinking database which is not having any insert/update

We have a process of archiving wherein we take the backup of current database and restore it as xxx archive database. Now this database contains previous data and will not have any ...
0
votes
1answer
23 views

Point in time restore fails - backup file from before the restore point not available (why does this matter)

I have tried to do a point-in-time restore of a database through the management studio gui, the point-in-time being yesterday morning (2016-04-12). This fails with the error "...cannot open ...
0
votes
0answers
23 views

installed 2012 SP3 after fixing missing cached installer files, @@ version shows up as sp1

I was to upgrade stg server running SP1 2012 standard, upon getting downtime on the first try I received multiple errors about missing installer cached files (.msp), which was fixed using Microsoft ...
1
vote
0answers
34 views

SQL Server dynamic inserts based on another table's rows

I've derived the following pseudo-coded script as a generic insert with variables that I want to replace for each row in another table (I can assume that the columns are always the same for the insert ...
0
votes
1answer
81 views

Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '*%text%*4' to data type int

I have a database that holds information linking customer data to forms that are filled out by them, or on them by someone else. Our UI runs reports but can only run 1 form at a time. I am trying to ...
4
votes
1answer
69 views

Get a listing of snapshot data files

I need to programmatically drop a database with all of its snapshots and then recreate the database and create a new snapshot. I'm having trouble locating where the snapshot files are located from ...
1
vote
1answer
48 views

Rebuilding partitioned table clustered indexes

I need to know how can we rebuild the partition table clustered index with the table size being around 270 GB with 126 Partitions on it. Also, I want to execute it in the production environment, so ...
9
votes
2answers
225 views

SQL Server sample Update of Statistics misses highest RANGE_HI_KEY on ascending key column

I'm trying to understand how Statistics sampling works and whether or not the below is expected behaviour on sampled statistics updates. We have a large table partitioned by date with a couple of ...
1
vote
2answers
59 views

Script/tool to use to check when the server is not being heavily used and configuring backup on Availbility Groups

If I were to backup 50 databases in SQL server, I want to make sure that backup is taking place when the server is not that busy. Is there any way or script/tool to use to check when the server is ...
0
votes
1answer
60 views

Automate backup using Windows Task Scheduler

I want to run an automatic backup of SQL Server 2012 Express using Windows Task Scheduler. I have 3 user databases. I want to backup all 3 user databases through a single stored procedure and a ...
7
votes
3answers
143 views

How to improve estimate of 1 row in a View constrained by DateAdd() against an index

Using Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64). Given a table and index: create table [User].[Session] ( SessionId int identity(1, 1) not null primary key CreatedUtc ...
0
votes
2answers
48 views

Trying to query AD on a linked server error message is 7321

Trying to query AD on a linked server error message is 7321 error occurred while preparing the query. Any suggestions? Select Name, EmployeeID, Mail, SamAccountName FROM OPENQUERY(ADSI, 'SELECT ...
2
votes
2answers
35 views

How do I detect execute permission granted to a role (when no ON clause was used)

I just spent hours trying to figure out how an app had privilege to execute stored procedures. TIL from StackExchange: Turns out the ON clause is optional for GRANT, allowing a role to be granted ...
10
votes
3answers
332 views

Is total_elapsed_time in DMV sys.dm_exec_requests completely inaccurate?

I am running SQL Server 2012 and am trying to put some queries together for monitoring using the DMVs. However, when looking at the total_elapsed_time field in the sys.dm_exec_requests DMV, the ...
1
vote
1answer
52 views

Unable to set user/group as principal on a proxy

I'm organizing permissions on our SQL Server instance. I want to stop using a SQL Server account, and instead grant permissions to Active Directory groups, and then add user and service accounts to ...
0
votes
0answers
11 views

Send SQL Server Snapshot to External FTP Server

I am trying to set up Snapshot-Replication for SQL Server 2014. I need Server 1, the publisher and distributor, to create a Snapshot and FTP to an external FTP server i.e. FTP server is not hosted on ...
1
vote
1answer
62 views

Create Linked Server using Active Directory account

I was able to grant access in MSSQL to an Active Directory group and add a service account to that group. It's working fine, I'm able to use trusted connection to login on that MSSQL using both my ...
0
votes
1answer
30 views

is there a max number of rows in a SQL Server 2008/2012 and MySQL table? [closed]

Im evaluating a RDBMS for a bank app solution and i need to be sure about these performance parameter. There is a lot of info on internet that is confusing me :O. Max number of concurrent ...
2
votes
1answer
126 views

Is it possible to disable use of fast forward-only cursor on server side?

I have an application that is using ODBC to access a SQL Server 2012 database using SQLSetStmtAttr to set the SQL_SOPT_SS_CURSOR_OPTIONS option to SQL_CO_FFO. This means that its reads from the DB are ...
1
vote
2answers
64 views

Can I access the file stream shared folder using Listeners in case of AlwaysOn cluster environment?

One of the most effective ways to extend your SQL Server Integration Services (SSIS) control flow is to use a Script task to write custom code that perform tasks you cannot perform with the built-in ...
2
votes
1answer
90 views

Joining 2 queries to match Months side by side

I have 2 SQL statements that I want to join up. The first gets the actual data per month for Turnover accounts. The second query gets budgets (if any) for the same Turnover accounts. Query 1 Actuals ...
2
votes
2answers
56 views

SQL Server 2012 Replication - MSrepl_commands growing all set to in progress

I'm stuck looking at this problem that we've had since our last restart almost a week ago. The distribution database is growing and no longer pruning; it appears that everything in the ...
1
vote
1answer
65 views

Deny users permission to create tables in master

I have noticed that I can create tables, schemas, stored procedures etc. the master database. I don't know what is granting this permission. It's annoying, because when we open a *.sql file in SSMS, ...
4
votes
2answers
264 views

How can I find the Database ID of a deleted database?

Where can I view/find the database ID after a database was deleted? I work in software/hardware environment and we have locking unit (prototype) synced in our S/W with unique DB ID. In order to reset ...
3
votes
2answers
110 views

Grant Admin to an Active Directory account in SQL Server

I have a SQL Server 2012 instance, and an Active Directory group, which I can add Active Directory users to. I have my personal AD account (MyAccount) and a service account (ServiceAccount) in that ...
1
vote
0answers
17 views

Server error in reports application

I have a server with SQL Server 2005 installed with the latest service packs. SQL Server 2012 express was been installed on same machine and seems to have broken the Reporting services service. When I ...
3
votes
1answer
75 views

Don't see it : Integration Services Catalog, and open the [All Executions] report

I have SQL Server 2012 Enterprise Edition (64-bit) on Windows NT 6.2. I am not seeing the option to the "[All Executions] report" in the Integration Services Catalog . How can I solve it? Update: I ...
3
votes
2answers
99 views

Transaction in a stored procedure

I need to perform an UPDATE and an INSERT in a single transaction. That code works fine on its own, but I'd like to be able to call it easily and pass in the required parameters. When I try to nest ...
2
votes
1answer
37 views

querying sys.database_principals accross a linked server

I'm attempting to get a listing of the users and roles they are associated with on a remote server to be input into a database on the local server. But when I use the linked server ...
0
votes
0answers
78 views

SSIS package fails, Odata connector to SharePoint Online

Using package developed in SSDT2012, deploying to SQL2012. I've worked through many errors/issues to get to this error: Package:Error: Failed to initialize SharePoint Client Runtime. Could ...
0
votes
1answer
23 views

Find all stats that were sampled

I am using Ola's scripts for stats updates and for one particular index I want to do full scans when updating stats (to solve for the Ascending Key problem in conjunction with trace flag 2389). We ...
1
vote
1answer
66 views

Combining 2 SQL queries

I have these 2 queries below that I use to calculate net profits from Jan to Dec. Query 1 /* Profit for the Period 13 */ SELECT * FROM ( SELECT MONTH(T0.RefDate) AS Month, '311999' AS 'SAP Code', ...
0
votes
1answer
35 views

Memory usage increases whenever I run stored procedures [duplicate]

I want to know why SQL Server memory use increases whenever I run stored procedures. After I stop and restart SQL Server, the memory used is just 1 GB. Each time I run stored procedures, the memory ...
0
votes
3answers
59 views

Find how many SQL Server instances are installed [closed]

On a SQL Server 2012 instance, how can I get the names of SQL Server instances using a SQL query? I want to show instance names currently installed in SQL Server.
0
votes
0answers
15 views

Any potential issues with changing the owner of a symmetric key?

We're doing a security audit on a database I support, and there's one old, obsolete user who can't be removed because he owns a symmetric key in the database. The symmetric key is being used to ...
3
votes
1answer
87 views

How to resolve this 'XML Validation: Declaration not found for element' error?

I'm new to SQL Server and I have this task to complete (for learning purposes), yet I'm unable to figure out this error due to inexperience with XML Schemas (I think) Here's what I'm trying to do - ...
0
votes
1answer
31 views

sql agent job timeout auto restart

we have a DWH load job that sometimes hangs. We have not been able to determine why this is happening it seems to be random and network/hardware related (which we have no control over). We are ...
2
votes
2answers
36 views

Trying to drop database only if it does not exist by using the db_id function fails

When the database foo is not yet created and I I run this IF db_id(N'foo') IS NOT NULL BEGIN ALTER DATABASE [foo] SET OFFLINE GO DROP DATABASE [foo] GO END I get a message Cannot drop ...
1
vote
1answer
33 views

Difference between Generate Script option at database level and backup and restore option

When doing that generate scripts on the database level what difference does it do from doing a backup and restore on the database? It seems to me that they both provide the same purpose. What would be ...
2
votes
3answers
57 views

Cannot create SSRS subscription for a report using SSAS as datasource

My questions is : how should I config SSRS subscription a report, which consumes SSAS datasource. I already googled and lookup stackoverflow a lot and still couldn't make it work. Problems: I ...
3
votes
1answer
43 views

Help with SQL Server and XML columns

I am writing a query to run against the SCOM 2012 OperationsManager database. SQL instance is Microsoft SQL Server 2012 - 11.0.5058.0 (X64). Within the database is a table called Monitors. The schema ...
2
votes
1answer
62 views

How to automatically fix Orphaned Users with PowerShell and SQLCMD

I'm trying to properly capture output from SQLCMD in SQL Server 2012. Here is the PS script: $dbname = "MyDB" $InstanceTarget = "localhost\SQLEXPRESS" $FixOrphansSQL=@" WITH login_CTE (name, type, ...
0
votes
2answers
53 views

After trying to restart moved database: Unable to open the physical file “D:\Data\MYDBNAME.MDF”

So the default location for databases on our server is c:\program files\microsoft sql server\mssql11.mssqlserver\mssql\DATA but due to space limitations we instead use d:\data I have now since ...
0
votes
1answer
29 views

Returning only the row with maximum value from related rows

In the example below how do I get the rows where the swap id is the maximum value in relation to the reservationId? I am currently joining multiple tables to get customer, reservation, room etc ...
0
votes
1answer
20 views

Problem with Processing Dimensions with Multiple Facts

I have a cube built in SSAS that uses 3 facts and 8 dimensions. Some of the dimensions are shared across 3 facts. When I process one of the dimension, it tries to process the underlying measure ...
1
vote
1answer
55 views

Same query plan, different data set, very different query duration SQL Server 2012

This may be a terrible question, because I'm not sure how information I can include to help. We have data segregated by customer. One customer apparently has higher volume of data. The same query ran ...
0
votes
1answer
24 views

SQL Query for searching table 'C' records only if records from table 'A' has specific values

I Have Three Tables, TBL-A, TBL-B, TBL-C, TBL-D TBL A has records for userstatus RECID USRID USERSTAT USRNAME 1 1 1 JOHN 2 5 1 HARRY 3 ...