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).

learn more… | top users | synonyms (2)

10
votes
4answers
2k views

How can I write windowing query which sums a column to create discrete buckets?

I have a table which includes a column of decimal values, such as this: id value size -- ----- ---- 1 100 .02 2 99 .38 3 98 .13 4 97 .35 5 96 .15 6 95 .57 7 94 .25 ...
2
votes
2answers
440 views

How do I rebuild single full text catalog (or why is “rebuild” full text catalog option disabled)

In SSMS. I have Full Text Catalog defined. If I select "Full Text Catalogs" folder - there is an option "Rebuild All" and it is enabled. But if I select individual FTC - "Rebuild" option (in context ...
-2
votes
1answer
674 views

How to enter multiple checkbox list items into database for eventual reporting [closed]

(I tried posting this on SO but went unansered. I'll just post these theory type questions here from now on) I'm in the process of creating the first of a few CheckBoxList for a manually created ...
13
votes
1answer
6k views

How to write a query which finds all circular references when a table references itself?

I have the following schema (names changed), which I cannot change: CREATE TABLE MyTable ( Id INT NOT NULL PRIMARY KEY, ParentId INT NOT NULL ); ALTER TABLE MyTable ADD FOREIGN KEY ...
2
votes
1answer
123 views

Powershell SQL Script Execution in Selected Schemas Only

I have many schemas in one database. In that database I have some SQL scripts to be executed. I want to execute those SQL scripts in only selected schemas. Suppose I have 10 schemas in total (A to ...
0
votes
1answer
544 views

How can I send HTTP requests from SQL Server 2012 to a non-.Net application? [duplicate]

I know basic only concepts (DDL,DML queries) of the SQL Server 2012. I explain the workflows of both my application and the database below. Workflow of the application: I build web application in ...
13
votes
3answers
7k views

SQL Server Agent Jobs and Availability Groups

I'm looking for best practice in dealing with scheduled SQL Server Agent jobs in SQL Server 2012 availability groups. Maybe I missed something, however at the current state I feel that SQL Server ...
1
vote
3answers
3k views

copy only tables with data from one database to another database [closed]

I have two database , dbOne(version - 10.50.1600 - locate in office server ) and dbTwo(version - 10.0.1600 - locate in my local server) . I want to copy dbOne's tables with data to dbTwo . Is there ...
0
votes
1answer
972 views

Insert missing rows to subscriber of Transactional Replication

I have established SQL Server Replication between SQL Server 2005 and 2008 R2. SQL Server 2005 is the publisher while SQL Server 2008 R2 is the subscriber. The replicated database is about 40GB. ...
7
votes
0answers
269 views

How to properly troubleshoot Merge Replication False Conflicts

We have SQL Server 2008 R2 Merge Replication setup. Lately I started getting conflicts for some tables, and when I check the conflict viewer, I can see that the winner & the loser column values ...
-4
votes
3answers
106 views

Trigger for database [closed]

As far as I understand Trigger can be written for the table of the database. Now I want the trigger for database. The database can contain multiple table, If there is any change even in one table the ...
1
vote
1answer
1k views

Capture Data Change Vs Triggers [closed]

I am constructing a database that needs to keep track of historical data. It is a Electronic medical system. All data needs to be updated in real time so the user can see what changes happened in the ...
3
votes
2answers
137 views

How to determine that the chain of log degraded

SQL Server 2005. I have DB with full recovery model. If i execute on my base ALTER DATABASE test SET RECOVERY SIMPLE ALTER DATABASE test SET RECOVERY FULL or BACKUP LOG test WITH truncate_only ...
1
vote
1answer
600 views

Migrating Oracle packages to SqlServer

I'm moving database from Oracle to SQLServer (2012 if that matters). The process of migrating tables/views is more or less straightforward and automated. Triggers are also not an issue since I don't ...
0
votes
1answer
406 views

xml queries with exist and contains giving unexpected results

I have a query as shown below. DECLARE @tbl TABLE ( id INT, col XML ) INSERT INTO @tbl VALUES (1,'<Root> <Row> <User>xyz</User> ...
2
votes
0answers
181 views

How to gracefully handle a source database restore from backup in a data warehouse

We are facing a challenging situation with our data warehouse source databases. Frequently these sources databases will be restored from backups. There is a high turnover of data entry persons who ...
7
votes
2answers
550 views

Seek predicate not using all available columns

I have a strange query compilation issue which is hard to reproduce. It only happens under high load and cannot be easily repeated. There is a table T with columns A,B,C,D. There is a non-unique ...
3
votes
4answers
476 views

Changing the representation of NULLs in pg_dump plaintext output

I'm trying to convert a large-ish Postgres DB (500 GB) to SQL Server 2012. After investigating a few third-party tools and being disappointed in features, performance, or both, I started pursuing a ...
13
votes
4answers
18k views

Formatting T-SQL in SSMS 2012

According to this Microsoft document: http://msdn.microsoft.com/en-us/library/ms174205.aspx I am supposed to be able to use ctrl+K then ctrl+D to format my SQL documents in SQL Server Management ...
2
votes
2answers
2k views

Finding the last command issued by a blocking process

I've developed an interface from ERP SAP Business One to warehouse management, and am facing problems concerning database locks. My program includes direct write operations into the ERP database (a ...
0
votes
1answer
1k views

What are safe characters to use in SQL Server Full Text Search? [closed]

I've been playing with full text search on SQL Server 2012. I must say my attempts to target special characters in search queries were futile - SS does not understand them. What's more, sometimes the ...
0
votes
3answers
1k views

Replication Options with data subsets

We have an application that makes of of a SQL Server 2012 (ServerA) database. Some data that we need to display, though, comes from another database, but it's SQL Server 2008 (ServerSOURCE). The ...
0
votes
2answers
327 views

Update primary SQL Server in mirrored environment using transaction logs from old environment

I'm currently migrating a large (~40gb) database to a new environment. The new environment is a HA/mirrored set up with primary, mirror and witness nodes. I'm backing up the database in the old ...
4
votes
1answer
791 views

Running functions in parallel

This is for SQL Server 2012. We have some import processes for FTP files that are picked up and read into a staging table, from there we massage/check the data before moving into production. One of ...
4
votes
2answers
6k views

Create table group sub-folders in Management Studio

When I was exploring the master database in SSMS I noticed that under the Tables folder there is another folder called Systems Tables that houses a bunch of tables. Is it possible for us to create a ...
1
vote
1answer
476 views

SQL Import/Export defaults to byte stream on export

So, I've done some research and I can't seem to figure this out. I'm not sure if it's some setting that I'm missing or what. For the basic info, running SQL2012, 64 bit, all that good stuff. I ...
8
votes
5answers
25k views

Error 3154 while restoring a backup using WITH REPLACE

I have SQL 2012 with SP1 installed on my computer. I made a backup of a database test.bak. I have a database with the name test2 which is the same database, but the data changed. I want to restore ...
2
votes
4answers
2k views

SQL Server grant permissions to STANDBY database

So, first: the setup. We have SQL Server 2012 (ServerA) running in domain A. We have SQL Server 2012 (ServerB) running in domain B, separate subnet, no trusts. These are completely separate domains ...
7
votes
1answer
1k views

Estimated vs Actual rows differences (actual much smaller than estimated) - sort

I'm running a query that is processing some nodes out of an XML document. My estimated subtree cost is in the millions and it seems it all comes from a sort operation sql server is performing on some ...
3
votes
1answer
5k views

Transaction Log Maintanance While Using AlwaysOn Availability Group

We are using HADR ( AlwaysOn Availability Group) feature of SQL Server 2012. Server and AG Configuration as below: SQL12_SRV1 --> AG1(PRIMARY) - SYNC -->> DBTest SQL12_SRV2 --> AG1(SECONDARY) ...
0
votes
2answers
941 views

SQL Server Maintenance Plan TSQL query to log the backup databases

Does anyone know how to use the TSQL task in SQL Server 2008 Maintenance Plan to log (insert) the databases that where backed-up? Imagine a Maintenance Plan that does the backup for DB1,DB2 and DB3. ...
2
votes
1answer
380 views

SQL Server connectivity and script execution using PowerShell

I am designing a PowerShell script that can execute some sql scripts in a folder. Actually this must be done remotely. I am able to connect to the particular server remotely using: $SqlConnection = ...
0
votes
0answers
40 views

How can I use Query notification and what are the requirement? [duplicate]

I want to use Query notification in my app to get the notification from database for updated data, so that app will fire the query to get updated data instead of monitoring the database for every 5 ...
2
votes
0answers
368 views

How to push the data from database?

I want to push the data from database to application instead of application pull the data.I have installed ms sql server and apache tomcat server. I have my application in apache tomcat, here I made ...
0
votes
1answer
2k views

Permissions on sys.syslogins

I've got the following scenario: ( loggend in on SQL-Server with full admin-privileges ) Creating LogIn, User, Role and associate them. IF NOT EXISTS( SELECT "name" FROM "master"."dbo"."syslogins" ...
1
vote
1answer
807 views

Count number of common column names among all tables in a database

Is there any way to compare every table with each other in a database, listing the number of common columns between each tables? I prefer using join over subquery and information_schema.columns over ...
22
votes
2answers
21k views

What is the actual behavior of compatibility level 80?

Could somebody provide me with a better insight about the compatibility mode feature? It is behaving different than I expected. As far as I understand compatibility modes, it is about the ...
0
votes
2answers
801 views

SQL Server AD groups membership seems cached - how to flush to test? [duplicate]

I am configuring a new, fully AD group based security scheme on an existing SQL Server 2008. When I change the group to which I belong to test my configs, it seems that there is quite a delay between ...
2
votes
1answer
644 views

Will certain Database Compatibility cause performance degradation?

I'm running a variety of SQL Servers from 2005 to 2012 across several machines. I have many of these databases running in SQL Server 2000 compatibility mode. Will using an older compatibility in a ...
4
votes
2answers
918 views

SQL server agent SSIS error

I get the following error when I execute my package as a SQL server agent job. It is an SSIS 2008 package running on a SQL Server 2008 instance. My package security is DontSaveSensitive. I don't ...
1
vote
2answers
2k views

How do I interpret the log when I run DBCC TRACEON (3502, 3504, 3605, -1)

I have been using DBCC Traceon (3502, 3504, 3605, -1) because it was recommended in a blog for discovering performance issues related to I/O. I'm running MS SQL Server 2008 R2 SP1 Results in my SQL ...
13
votes
1answer
18k views

SIMPLE or FULL recovery model for databases?

When should I use the full recovery model and when should I use the simple recovery model for databases? I always used the full recovery model because it is the default, but today i encountered this ...
2
votes
2answers
181 views

Using Change Data Capture with a frequently changing schema

We are following an agile development process, which in this case means that we frequently make changes to the database schema, e.g. adding new columns, moving data to other columns, etc. Is there a ...
0
votes
0answers
83 views

Windows Server failover cluster [closed]

I have 5pcs. IBM System x3650(7979 - ex. ESX/VMWare, planned EOL) now with baremetal Win2012 DataCenter, every machine has the same HW and SW (inc policy). I want to create two clusters (MS SQL), for ...
1
vote
1answer
638 views

Querying Change Data Capture data

I have Change Data Capture enabled and working fine. The question that I have is how do I query the data to show users what changes occurred.
3
votes
2answers
2k views

Issue importing large file into SQL server

I am trying to import a 4gb csv file into a new table in sql server using the wizard. And when I do I get the errors below. I also included the 2nd row of the file I am trying to import without the ...
1
vote
2answers
2k views

Databases outside of AlwaysOn availability group stuck in RESTORING status

I am testing the AlwaysOn feature of SQL Server 2012. I have 2 servers set up and can successfully create availability groups and fail them over between servers. However, any databases that DO NOT ...
9
votes
3answers
2k views

Get transactions that failed or were never committed

Is there anywhere I can look to find failed transactions in SQL server 2012?
4
votes
1answer
114 views

What is the difference between these two index declarations and do I need both?

I was examining a script with 'Display Estimated Execution Plan' and it made several recommendations for indexes to add to the database. I added them and the script did indeed run much faster. Now ...
0
votes
2answers
2k views

SQL Server to Oracle export using Microsoft OLEDB Provider for Oracle

I am trying to Export Data from SQL Server to Oracle using the "Microsoft OLEDB Provider for Oracle". I am using "Export Data..." option from Task menu. I get to connect to the source database (SQL ...