Tagged Questions

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)

0
votes
2answers
32 views

Build replication from backup not publication source

I have an interesting scenario I am trying to find a solution to. We currently have the current setup. ProductionDatabase (publisher) is the publication for transnational replication to the ...
3
votes
1answer
213 views

Formal name for functions that use the OVER clause

Is there a formal/academic name for the family of functions in Sql Server like ROW_NUMBER(), LAG, LEAD, RANK etc, that make use of the OVER(ORDER BY <PARTITION BY> ) syntax? How much of this is ...
0
votes
1answer
39 views

Show Non-NULL values from 2 columns in a single column

I need to take the non-null values from two columns and show in a new column: ‘D_Country’. C_Country(Customer) P_Country(Prospect) Each of these columns may have NULL values depending on who the ...
3
votes
2answers
128 views

Reindexing Clustered Primary Key

We need to reindex a Clustered Primary Key on quite a large table. Here is the definition of the table: Data Size: 22GB Index Size: 34GB Total Non-Clustered Indexes: 3 Row Count: 54 Million Data ...
1
vote
1answer
198 views

Why do sys.columns and INFORMATION_SCHEMA.COLUMNS display different number of columns [closed]

Here i am try. Two method to display Particular column name in particular Database in sql server 2008 R2? Use INFORMATION_SCHEMA.COLUMNS SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE ...
0
votes
1answer
60 views

How can I restore ##MS_SSISServerCleanupJobLogin##?

At some point the SSIS cleanup job login (##MS_SSISServerCleanupJobLogin##) got deleted from my sql server (2012). I'm trying to upgrade to SP2 and I'm getting an error message I believe is related to ...
5
votes
2answers
377 views

Index seek much slower with OR condition compared with separate SELECTs

Based on these questions and the answers given: SQL 2008 Server - performance loss possibly connected with a very large table Large table with historical data allocates too much of SQL Server 2008 ...
5
votes
2answers
159 views

Adding a sequence number to existing rows

I have a table with an OrderSequence column. The schema looks roughly like this: id Name OrderSequence I have an array of ids ["1", "2", "3", "4"] from an application, and I want to set the ...
0
votes
1answer
43 views

Trigger on a Schema

Is it possible to create a Trigger on a Schema? I have to audit the changes on my tables. But I have a lot of tables and I don't one to create a trigger on them one by one. --Database level trigger. ...
1
vote
1answer
42 views

Will Transactional Replication Work?

I have multiple site servers and a central server. Each has a Widget table with identical schema. There is currently a custom process that sends new Widget records from the site server that ...
5
votes
2answers
250 views

SQL Server: Create New GUID Values for Existing Index

I have an existing table with about 6 million rows. The relevant columns are: ID int not null PK Key uniqueidentifier not null Read/write on this table by Key lookup is probably something like 100 ...
1
vote
1answer
137 views

Performing deltas / diffs over VPN from Oracle to SQL Server database

I have inherited a reporting structure that is quite the Rube Goldberg device. I have a collection of MS Access 2003 databases that I have begun to migrate to SQL Server. My current hangup is that we ...
3
votes
1answer
127 views

Difficulty getting sp_executesql to work

Alex Aza's comment solution here generates all names of tables with records referencing a specified input record. I would like to adapt Alex's solution into a table-valued function. I'm having trouble ...
0
votes
0answers
138 views

SQL Server, I can execute sqlcmd with trusted connection but not sqlpackage

We have some deployment scripts that use a combination of dacpacs through sqlpackage and straight scripts using sqlcmd. When I execute the sqlpackage dac\sqlpackage.exe ...
8
votes
1answer
934 views

What happens during “big” inserts on a table with a clustered composite key?

My SQL knowledge is limited, so the terms I'll be using are most likely not the right ones. I have a table that will store test results, for multiple locations. The tests will be recorded in ...
0
votes
1answer
81 views

Update primary key column - NULL issue

I want to update a column that is a primary key using this code use BITS_TEE Update DMT_TEE_DTS_Production set ABCIndicatorCode = ( select HIST.ABCIndicatorCode from ...
2
votes
1answer
270 views

Change rowguidcol property to a different column

In my SQL Server 2008 database, I have a table with two uniqueidentifier columns. CREATE TABLE MyTable ( Col1 uniqueidentifier rowguidcol not null, Col2 uniqueidentifier not null, ...
4
votes
1answer
112 views

Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL Server 2012 [closed]

I just read the Brent Ozar Weekly Links email (July 28th Edition), and noticed the "Kendra's Link" talking about "Fix: Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL ...
0
votes
1answer
84 views

Case always returns null?

I have a subquery that gets the DATEDIFF of two dates. However the first case always returns null yet the actual sub query returns dates?! CASE WHEN [date1] > [date2] THEN ...
1
vote
1answer
41 views

Spatial Index ignored when using additional non-spatial conditions

Why does SQL Server ignore my spatial index when I use additional conditions? If I add an INDEX hint it will use the correct index, and runs a lot faster. I would like to avoid using the hint if ...
1
vote
0answers
84 views

1 TB Database import, best options? [closed]

Friends, We have received 1 TB external hard drive with 750 GB MS SQL server zipped backup file in it from our client. We need to import this database at our end and then write programs to retrieve ...
0
votes
1answer
57 views

Select IDs according to CSV file

I have a CSV file with IDs of rows. I want to use that to make a SELECT statement selecting the IDs within that CSV file. There is 1 million rows and I want to select about 95,000 of those. I want ...
4
votes
2answers
116 views

Sql Server Management Studio login prompt will never forget other sql user than SA

When I login to a database, using some other user than SA, that username will stick the next time I login. If I then input the username SA and password and logs in, the next time I open the login ...
1
vote
2answers
228 views

Fixing an error 9004 without taking the database offline

My database (SQL Server 2008 r2) is running fine but I’m getting the following error in my event log. Error: 9004, Severity: 23, State: 6. An error occurred while processing the log for database ...
2
votes
2answers
135 views

Help reading deadlock XML

Even with reading the Bart Duncan blog about reading deadlocks I still struggle with this. I have included the XML from a particular deadlock. <?xml version="1.0" encoding="utf-8" ?> - ...
1
vote
4answers
394 views

Large table with historical data allocates too much of SQL Server 2008 Std. memory - performance loss for other databases

Based on this question and the answers given: SQL 2008 Server - performance loss possibly connected with a very large table I have discovered memory allocation problem with SQL Server 2008. ...
1
vote
2answers
49 views

Store n:m data with most n:1 tuples

I have these tables: create table data ( id int identity not null, ref int not null ); create table reference ( refid int not null ); with ~2 million rows in data and ~200k rows in ...
-1
votes
2answers
59 views

Get the table affected by the query

How I can get the table which is affected by the query? Example Update cust Set name = 'john' Where custid = '4001' Output: cust ___________________________ Insert into emp(fname, lname) ...
0
votes
2answers
174 views

SQL Server 2012 Browser Service doesn't appear [closed]

I've installed SQL Server 2012 and Management Studio Express. I attached the database that belongs my previous Project in Visual Studio. But I am having SqlException Error , I think the reason of the ...
1
vote
1answer
68 views

Cluster Size Configurations for SQL Server at RAID Level

I was reading the below two articles (one of which I posted) and one recommends to use a RAID cluster stripe size of 256k while the other recommends to use 64k. There is a big difference between the ...
0
votes
1answer
56 views

Migration query taking time

I'm doing a migration from Oracle to SQL Server and, for one of the tables where we have 3 million records, it is taking a lot of time to complete. When I check the activity monitor, I can see the a ...
0
votes
1answer
200 views

INSERT/SELECT slow after TRUNCATE TABLE on table with 6 over mllion rows

Seeing slowness in insert/select after truncating a table that has over 6 million rows. I daily insert 5 to 6 millions records into a table and I was able to insert/select data without any issue for ...
0
votes
1answer
77 views

Migrating SQL database to a new SQL server

Thanks for viewing my question. I currently have a database on SQL Server 2005, which is being migrated to SQL Server 2008. Each SQL Server is named differently in SSMS. The old is named GARDB1, and ...
4
votes
1answer
68 views

Does anyone have example for setting up a job to reduce SQL Server max memory and recycle SQL server service?

I have both SQL Server 2008 and SSAS running on the same machine (Don't ask me why, I have to live with it for now!). Since we run ETL and Cube generation in sequence, I wanted to allocate large ...
1
vote
3answers
96 views

How do I select 1st row of each table and insert that data to a new table

i have 5 tables (tab1, tab2, tab3, tab4 and tab5) and all the 5 tables has same table definition. I want to select 1st row of each table and insert those 5 rows in new table(newtab). I was only able ...
4
votes
1answer
117 views

Differential/T-Log LSN question

So, this is now my third question on this topic. I just keep finding more and more than i want to know and understand about how FULL recovery works. We transitioned a database to FULL yesterday by ...
0
votes
1answer
115 views

Is this a good case for multiple SQL Server instances on a VM?

We have a suite of applications utilizing SQL Server have the following characteristics: Users create/destroy DBs via a UI, so DBs appear/disappear without DBA assistance. DBs of the same name can ...
1
vote
1answer
44 views

Troubleshooting Resource Governor / Classification Function [closed]

I've been trying to configure / troubleshoot the resource governor on a sql server 2014 instance. I can't get any work into anything but the default resource pool. I've been following this ...
0
votes
1answer
67 views

sql server Group by with calculated values

I have two tables: costumer table and invoice table. How to calculate sum(value) for each costumer (id) when I have calculated variables in group by statement - without puting code for calculated ...
0
votes
1answer
78 views

Page compression not working?

I have created a table where I have around 100 partitions (per month), all of them are configured to use page compression. After that I'm inserting data to this table month by month. I now would ...
0
votes
1answer
63 views

Risk of disabling page locking

In another question a user asks how to force row level locking. The answer that he receives tell them how to force row level locking by altering the table and the indexes. The user that answered the ...
0
votes
2answers
118 views

View with left joins are very slow

I have a view based on join of 3 tables and and query on view is taking 10 mins to fetch the results. Can anybody help me in reducing the time taken to fetch results? VIEW CREATE view ...
0
votes
1answer
106 views

Need Advice on Normalizing Database

I have a group of database tables that lack normalization. They all have a similar primary key called 'doc_index', which is either a PK by itself or part a composite PK. As you can see below, there ...
3
votes
5answers
464 views

Using Timestamp plus Integer as Primary Key

In Sql Server, what would the drawbacks and disadvantages be of using a primary key that is: Two Character Table Identifier + YEAR + MONTH + DAY + HOUR + MINUTE + MILLISECOND + random integer between ...
1
vote
0answers
44 views

Column Data Type for Bitwise Comparison?

I have a table where I have an int32 column storing values for bitwise comparison. I've ran out int space with a int32. I can convert to int64 but that will just prolong the inevitable. Is there an ...
3
votes
1answer
86 views

Is support for Parallel Scalar UDF a reasonable feature request?

It is fairly well documented that scalar UDF's force an overall serial plan. Running functions in parallel Given a large number of rows coming into a point in the pipeline where a UDF must be ...
7
votes
6answers
2k views

Estimate projected database growth

I recently started working with SQL Server 2008 as a DBA trainee. I need calculate the size of the database but also estimate its growth over recent months and the predicted growth for the next 12 ...
0
votes
2answers
68 views

Derive daily delta from total daily counts? Tsql

I have a table with columns: ID, tableName, totalRowCount, Date Each day I'm appending the number of rows in the relevant table. What I want to do is create a table which has the number of new ...
0
votes
1answer
69 views

Nested cursors, multiple result sets

I'm using a SQL Server stored procedure to generate an Excel report. Basically each "entry" in the report has three parts: Object, Observation, and Points. The observations have a reference to the ...
3
votes
4answers
182 views

Are we a good fit for SQL Server Enterprise and table partitioning?

We currently have a production database that contains millions of records (14 million in the largest table). One function of the database is to provide time sheet information so a single table could ...