Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).
3
votes
2answers
89 views
DBCC SHRINKFILE works with file_id but not with logical name
I am trying to shrink a database file but am running into errors.
Using the file_id from sys.database_files works, but using the logical file name yields an error.
The logical file name is the same ...
0
votes
2answers
69 views
Database Mail sending functionality not working on local system
I am using Database Mail functionality to send mail from a SQL Server 2008 database via following stored procedure execution:
EXEC sp_send_dbmail @profile_name = 'MyProfile',
...
2
votes
1answer
29 views
Data sharing between client and server two ways
One of my Silverlight applications is running. This Application is using one central database (SQL-Server 2008) and three other client databases (SQL-Server 2008) in server other locations.
Our ...
0
votes
0answers
24 views
SQL Server 2012 linked server to SQL Server 2000
I am trying to select through an linked server from SQL Server 2012 to SQL Server 2000.
The linked server has been setup and I can browser the target database through the linked server which ...
2
votes
2answers
69 views
Reset IDENTITY value
I have a table with an IDENTITY column. While developing I delete the rows from time to time and add them again. But the IDENTITY values always kept increasing and didn't start from 1 when I added ...
2
votes
1answer
72 views
SQL Server Many-to-One replication
I have 8 individual SQL Server 2008 R2 machines, each hosting 1 database. Each database has an identical table structure and schema, and entirely unique data.
I would like to establish a reporting ...
5
votes
6answers
338 views
Find procedures that haven't been called in <n> days
We are deleting old stored procedures and tables.
How can I know what procedures haven't been called recently?
dm_exec_procedure_stats and dm_exec_query_stats aren't reliable, since they only return ...
2
votes
0answers
25 views
Cannot Delete FileStream Group from Sql Server 2008
We have migrated all our varbinary(max) column data to Azure Blob Storage and so we want to remove the old filestream columns that remain in our Sql 2008 database and the filestream filegroup but when ...
0
votes
2answers
74 views
Move database files if database runs
is possible, is there internal procedure to moving with database files if database runs, is not detached on Sql Server 2012/2008, .... EDIT.... database is online, accesible for users, services ...
-1
votes
0answers
38 views
Optimize SQL Select Command [closed]
Is there anyway to speed this up by optimizing/condensing the code?
SELECT fullName, email_address, pos_desc, EXT
FROM dbo.BTC_WEB_EMPLOYEE_VIEW
WHERE grp_cde = 'STAFF'
OR grp_cde = 'PROF'
OR ...
4
votes
2answers
55 views
What is the best way to migrate multiple databases?
I want to migrate my database server to a new server. Right now I have a database server with Windows Server 2008 and now I am migrating to a new, separate server with Windows Server 2012.
There are ...
2
votes
2answers
58 views
Can I install SQL Server 2012 on a machine with 2008 R2 already?
I have been using SQL Server 2008 R2 for quite a while, and it is working great. Now I need to use SQL Server 2012. Will this effect my existing databases? How much risk is involved in installing SQL ...
0
votes
0answers
37 views
Synchronization between master and backup server
I am searching for an option to synchronize data between production server and backup server automatically. Does somebody know a method, how I can do this:
if I delete, insert or update a record it ...
2
votes
2answers
36 views
Can I restore an uncompressed differential backup after a compressed full backup?
If we enable compression on database backups (because the database backup size is huge) but don't enable it on differential which are relatively small in size, will a restore work? Because the full ...
3
votes
2answers
75 views
Import Data replaces NULL with 0
I am using sql server 2008 r2 express. I am getting some problems when i use import data feature to import data from one database to another. I am using SSMS to do it. While using the wizard i choose ...
1
vote
1answer
34 views
how to rebuild / reinstall ssrs (reportserver, reportservertempdb) databases?
Our server crashed. We got it back up and running however, the mentioned databases have been corrupted.
Is there a programmatic / automatic way of rebuilding or reinstalling the SSRS databases?
If ...
0
votes
0answers
13 views
“Row not found at subscriber” with a row filter
I had a production issue today where delivery of a handful of update statements failed at the subscriber with "row not found". What's odd about it is that I have a horizontal filter set up on the ...
-2
votes
0answers
101 views
Cross-product generates duplicate rows, how to unique/distinct the result?
CREATE TABLE tbl_T0(fid int, haz float);
CREATE TABLE tbl_T1(fid int, foo text);
CREATE TABLE tbl_T2(fid int, bar money);
Populate each table with some data, then create views with ROW_NUMBER():
...
0
votes
1answer
67 views
SQL Agent embedded PowerShell script in CmdExec step fails with import-module sqlps
SQL Server 2008R2
PowerShell 2.1
I am trying to create a SQL Agent job that dynamically backs up all non-corrupted SSAS databases on an instance without the use of SSIS. In my SQL Agent job, when I ...
1
vote
4answers
92 views
Can I add a unique constraint that ignores existing violations?
I have a table which currently has duplicate values in a column.
I cannot remove these erroneous duplicates but I would like to prevent additional non-unique values from being added.
Can I create a ...
1
vote
2answers
50 views
interpreting how much data has been lost by analyzing dbcc output
We had a SAN outage and this corrupted several databases with no backups.
We ran this to do a repair:
EXEC sp_resetstatus 'test'
ALTER DATABASE test SET EMERGENCY
DBCC CheckDB ('test')
ALTER ...
2
votes
4answers
65 views
How to block user access to perform database application update?
Where I work we have a SQL Server database (Microsoft SQL Server 2008 R2) that serves as the back-end with two different user interfaces, a .NET web interface and a FoxPro interface.
Every month we ...
2
votes
1answer
63 views
Create a sub query for sum data as a new column in SQL Server
Suppose that I have a table named tblTemp which has this data:
| ID | AMOUNT |
----------------
| 1 | 10 |
| 1-1 | 20 |
| 1-2 | 30 |
| 1-3 | 40 |
| 2 | 50 |
| 3 | 60 |
...
0
votes
4answers
39 views
SQL Server transaction log growing without control
We have a database growing uncontrolled and filling the hard drive every 2 days. Database maximum log size is set to 6 gb but id doesn't seem to be working because it continues growing beyond 6 gb.
...
4
votes
0answers
53 views
Indexing strategy for dynamic predicate
Assume SQL Server 2012 Standard edition.
My database has a table with 500 million rows. The table has about a dozen columns, none of which are very wide (some varchar(100)'s and some ints).
The ...
-1
votes
1answer
49 views
Good example of long stored procedure? [SQL Server] [closed]
I have a 400-line stored procedure that I need to copy and refactor for my own purposes. I'm new to SQL but I do think that the stored procedure that I'm working with can be cleaned up. I have been ...
7
votes
4answers
384 views
How should I best handle a rapidly growing database?
I have a database that I need to maintain.
Sadly, the setup and use of that database I can't change, much (thanks to some internal politics).
It's running on SQL Server 2008r2.
Its only been live ...
0
votes
0answers
50 views
Error 0xc02020f4: Data Flow Task 1: The column cannot be processed because more than one code page [closed]
SQL SERVER :
i executed an query and i got result of 8 million data. I have to create a table out of this result output.
SO i simply save the result out to table1.csv.
Now when i try to import ...
3
votes
2answers
109 views
SQL SERVER - Linked Server and query performance
I have a performance problem related to SQL Server/linked servers/views.
I hope you can help me understand what is the best way to do what I want =).
I have a database K with 3 linked servers ...
1
vote
1answer
49 views
Sql Server Server Group query
Scenario
I have 4 front-end sql server.
All of them have the same db instances. Data are replicated from back-end databases.
Issue
In SQL Management Studio I have registered the servers and I have ...
2
votes
4answers
33 views
What happens when I try to store more 8019 bytes in a SQL Server table row?
I read -
total fixed and variable length data are still limited to 8019 bytes total
But my data can possibly be more than this. What happens if it's more. Does it still store the data correctly?
...
3
votes
1answer
63 views
Increment of integer PK values by 1 doesn't throw duplicate key error. Why?
As stated in the title I am wondering why the following piece of code will note fail with duplicate key error. As a result of the following test, obviously, the update does not check for duplicity ...
0
votes
1answer
37 views
Displaying multiple data in a column [closed]
I have the following table structure:
Table A: id, rname, idB, idS
1, Learning, 11, 22
Table B: idB, Bname
11, Astronomy
111, Building
Table S: idS, Sname
22, Google
222, Freddy
Table ...
0
votes
2answers
75 views
How to merge data sets without including redundant rows?
I think this must be a fairly common thing to do, but I haven't been able to find an example. It involves merging data that involves dates/times (or more generally any sequential values) without ...
0
votes
1answer
36 views
Connection to local SQL Server 2012 can be established from SSMS 2008 but not from SSMS 2012
I have two local SQL Server instances running on my local machine. The first is SQL Server 2008 R2 Enterprise Edition (named MSSQLSERVER) and the 2nd is SQL Server 2012 Business Intelligence Edition.
...
12
votes
1answer
225 views
“Access is denied” when connecting SSMS to Integration Services
I receive the following error when attempting to connect SSMS to Integration Services using a particular SQL Server cluster's network name:
Connecting to Integration Services service on the ...
5
votes
0answers
100 views
-E startup option and SSDs
Has anybody seen evidence of the effect of -E when using SSDs?
The effect on 'spinning rust' drives is not disputed - but SSDs aren't really flustered by random I/O. I wonder if the -E option might ...
1
vote
2answers
70 views
Does a database restore remove existing stored procedures
I have a PROD and NON-PROD system
NON-PROD already has a copy of an application PROD database
I have also created new stored procedures on the NON-PROD application database and made changes to a ...
0
votes
4answers
87 views
How can I create a fresh copy of a large database on SQL Server?
I have a very large database (400GB) that is now corrupted. I tried repairing it with the repair_allow_data_loss option, but that did not fix the problem so my next option is to restore to a previous ...
3
votes
1answer
93 views
Linked server available to users without permissions
I have users seeing a linked server which they are not supposed to see.
The linked server is defined so that only I will have access to it, but everybody can see and use it.
I have created the ...
1
vote
2answers
72 views
Format function returning minutes instead of months?
While exploring the new function FORMAT I have come across the following issue, would like to know if any one else has faced a similar problem and found the fix for this, or if it is a bug?
SELECT ...
2
votes
1answer
54 views
SSIS - How do I execute a single OLE DB Command for mutiple paths?
I have an SSIS package (2008 R2) that I'm working on and I find myself duplicating the same OLE DB commands repeatedly and whenever there is a change its a nightmare to go back through and update all ...
6
votes
3answers
189 views
Splitting SQL query with many joins into smaller ones helps?
We need to do some reporting every night on our SQL Server 2008 R2. Calculating the reports takes several hours. In order to shorten the time we precalculate a table. This table is created based on ...
2
votes
0answers
86 views
How can row estimates be improved in order to reduce chances of spills to tempdb
I notice that when there are spill to tempdb events (causing slow queries) that often the row estimates are way off for a particular join. I've seen spill events occur with merge and hash joins and ...
0
votes
2answers
64 views
Does a SQL Server job run on the server or the local machine?
Does a SQL Server job always run on the server, or will it run in the context of the local machine, similar to a DTS package run from Enterprise Manager on the user's machine?
The job in question ...
0
votes
0answers
10 views
MSSQL compound query [migrated]
Hello and thanks for looking.
I wrote a simple application for my softball team and I am having some issues with the query I need to rewrite.
SELECT DISTINCT _StartDate, _RescheduleDate, _GameTime, ...
2
votes
2answers
107 views
Are there design patterns/best practices in writing dynamic SQL in stored procedures? [closed]
I'm an experienced programmer but I'm new to SQL/databases so please bare with me :).
One of my current tasks involve editing (and refactoring, if needed) a dynamic generated SQL statement in a ...
2
votes
2answers
76 views
Does Change Data Capture (CDC) work in a SQL Server 2012 AlwaysOn Failover Cluster Instances setup?
Does Change Data Capture (CDC) work in a SQL Server 2012 AlwaysOn Failover Cluster Instances setup?
There would be two nodes in the AlwaysOn Failover Cluster Instances setup and two Domain ...
0
votes
1answer
35 views
SQL server 2012 upgrade causing reindexing to take a long time / fill up log file
I have a customer who has upgraded their SQL Server from SQL Server 2005 to SQL Server 2012. According to them, no other changes were made. They have an ERP database which does a full reindex once a ...
0
votes
0answers
72 views
Creating Superset and Subset table with relationship mapping
I have requirement in one of the project where different entities
like Teacher,School,Student Store addresses in single table and maintain their relationship.
Example
-School can add teacher and ...
