Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-server-2008]

SQL Server 2008 (major build version 10.00.xxxx). Please also tag with sql-server.

0
votes
1answer
48 views

Output File Default Location using MultiServer Agent Jobs

I've used Ola's scripts for quite a while at several companies, and just started a new job at a company who has already implemented MultiServer Agent Jobs to execute backups, DBCC CheckDB and ...
0
votes
0answers
487 views

Query to get blocking duration

Is there a query to get the total duration time of the blocker? For the instance above, SPID 54 is blocking 55 for 132855 ms or 2min. Let's say, after 1 min, 54 is still blocking 55 AND blocking a ...
1
vote
1answer
118 views

Find the destination owner (schema) for replication on SQL Server

We have a table replicating to another server with a different Schema at the destination. When I set the replication up it shows as destination owner in the GUI. I am trying to create some reports ...
0
votes
1answer
371 views

How to reduce table partition timing for existing table in SQL Server

Repost from: https://stackoverflow.com/questions/48169487/how-to-reduce-table-partition-timing-for-existing-table-in-sql-server I have a problem with table partition, I am working in a very big ...
0
votes
0answers
188 views

Same Domain Linked Server Login Failing

I have several SQL Server instances. All of them are setup in the same domain, and have been working for years. One of these instances serves as an aggregator for the data of the others, and a sync ...
1
vote
1answer
50 views

Does this set of locks imply table lock and if so is it avoidable?

I have a query on SQL Server 2008 that when using sp_whoisactive with get_locks = 1 has the following locks open.... <Object name="my_table" schema_name="dbo"> <Locks> <Lock ...
0
votes
2answers
43 views

How do i merge multiple records into a single record

I have a select query: SELECT 'IT Queue' as Category, dbo.Status.Status, COUNT(*) AS Count FROM dbo.Status INNER JOIN dbo.CactusQueue_Task ON dbo.Status.Id = dbo.CactusQueue_Task.StatusId ...
0
votes
1answer
43 views

Query whith DATETIME

How to get this result expected result CodeCompany fechaActual Clave Usuario Depto entrada salida sumaHoras 2300 201712 307 USER1 TTT 06:00:04 ...
1
vote
3answers
599 views

Delete and Insert performance SQL Server

I have the below stored procedure that is taking close to an hour to complete. The result set is about 200K machines. All I am doing is extracting a set of ids from a linked server, deleting those ...
2
votes
1answer
1k views

Calling two stored procedures from one, is the order guaranteed?

I have some code that looks like this: EXEC StoredProcedure1 @Arguments EXEC StoredProcedure2 @Arguments Are the two datasets guaranteed to return in the called order? I am expecting two ...
-2
votes
2answers
118 views

Auto update of a column's value (SQL Server 2008)

I want update the value of a column in a table after 24 hours. We're booking a car for a customer; if he doesn't confirm within 24 hours, the car's status should automatically change to "stock". How ...
1
vote
3answers
882 views

Join tables where the table name changes every day

I need some help in figuring out how to join tables to my query. The table names change every day as the date is used in the table name and older tables are dropped as they are no longer needed. My ...
0
votes
2answers
152 views

Returning only duplicated data

I'm searching all over the internet and stack Overflow but every example I find is with only one row, or it just does not work. I have this table: TBL_RELATORIOS_TAMANHOS table_catalog table_name ...
2
votes
2answers
66 views

Changing the column width in Transactional Replication

Changing the column width in SQL server Transaction Replication. Can we do direct width change ? or we need to takeout the article and modify. This change replicate to subscriber? or we need to do ...
5
votes
1answer
2k views

NVARCHAR(MAX) string appears to have 6326 characters but won't PRINT them all

I am writing a stored procedure to use the sp_send_dbmail system stored procedure to send an HTML email. I have used this procedure before but have not run into this problem before. I am using the ...
2
votes
0answers
307 views

Insert 2 output result sets from sp_spaceused into Temp Table (SQL Server non-2016)

sp_spaceused, when executed without any parameters, produces 2 result sets database_name, database_size, unallocated_size reserved, data, index_space, unused Usually when you execute some SP, you ...
7
votes
1answer
4k views

Access view based on table in another database without account in that other database

I created view in database1 based on tables in database2. I gave SELECT permission to a user who has access only to database1. The user can't get this view to work because he doesn't have an account ...
0
votes
1answer
37 views

what are the impacts if I convert one of the column to primary key or add a primary key to an existing table

One of my MSSQL table don't have any primary key, I would like to add one. Just want to know: First, if I convert an existing column (or multiple columns) to a primary key, what would be the impact? ...
3
votes
2answers
352 views

I have a database backup (.bak) from SQL Server v7, how do I convert it for load into v10?

A client has given me a backup (.bak) from a SQL Server v 7 database. I am trying to load it into version 10 which is incompatible. Are there any tools that will restore or prepare an old version ...
3
votes
1answer
99 views

SSIS Excel export changes # to

I am exporting an excel file through SSIS using excel connection manager. I am using SSIS 2008 version and the excel is .xlsx CREATE TABLE `Sheet1` ( `Date` DATETIME, `NMMO` NVARCHAR(30), ...
1
vote
1answer
67 views

# of key locks while updating

I am using SQL Server 2008, RTM. I have a simple table defined as create table t(id integer not null primary key) This table has 50,000 records, just in case. When I issue an update transaction ...
0
votes
2answers
45 views

Restore user in DataBase that in master have mapped the child database but in child database doesn't have the user created

I don't know why te following database arrive to this point but this is the situation In master security you can see the defcon\axadmin user with DAXTest database mapped But if you go to the ...
0
votes
1answer
55 views

Why is my cursor not stopping in the last table?

This is the cursor: Declare @CMD VARCHAR(MAX), @CMD1 VARCHAR(MAX), @CMD2 VARCHAR(MAX), @MSG VARCHAR(MAX), @TABELA VARCHAR(100), @...
0
votes
2answers
275 views

Side By Side Upgrade and Migration from 2008 to 2016

Side By Side Upgrade and Migration from 2008 to 2016 Old Server Name Test1 New Server Name Test1 Default Instance Test 1 My question is when the new server be named as the old one 'Test1" and it ...
0
votes
1answer
1k views

Setting up Mirroring in SQL Express Edition

I know doing something like mirroring in SQL Server express edition is not possible, but can we do real-time db backup and restore and setup some automated task which acts like mirroring and keep them ...
0
votes
1answer
100 views

Restoring MSSQL back-ups to Oracle 12c

I currently have an Oracle 12c DW that has several data sources of varying types (MSSQL, Oracle, MS Access, PostgreSQL, etc.) being moved into it as part of our existing ETL process. We have FME (...
0
votes
1answer
84 views

Incrementing an integer every 150 rows

I'm trying to write a SELECT query that calculates a BatchNumber column that increments by 1 every 150 rows, starting at 1001. The expected BatchNumber should be 1001 for the first 150 rows, then ...
-3
votes
1answer
951 views

Should I choose subquery or 'group by' for faster performance

Table: person | ethnicity james | white bill | african Lina | african Ruby | Latin josh | Latin SQL query 1: SELECT * FROM (select count(*) from MyTable where ethnicity = 'white') sub, (...
1
vote
1answer
1k views

Need to filter SQL database data by time interval (1 sec, 1Min, 10 Min,1Hour, 2Hour) [closed]

I want filter SQL database data by time interval (1 sec, 1Min, 10 Min,1Hour, 2Hour) I want to fetch data from "ProDataTable" by in between Start Date and End Date with Interval of (1 Sec, 1Min, 10 Min,...
-1
votes
1answer
861 views

Turn Rows Into Dynamic Number Of Columns

I have a table in SQL Server that is horrid design, but am in need of a way to display ONE row per username with a breakdown of each item and qantity of that item the person sold. This is sample DDL ...
2
votes
1answer
2k views

Merge two XML outputs to one from SQL query

I have following code developing 2 XML files but I would like them to be in one file itself with multiple Organization tag. SELECT LTRIM(RTRIM(c1.cptname)) as "orgHeader/orgCode", LTRIM(RTRIM(c1....
16
votes
1answer
6k views

Ignore accents in 'where'

In our database we have multiple entries with caron/hatschek. Now our users want to find entries including caron/hatschek when they search for entries without. I'll show this by a simple example: In ...
1
vote
1answer
2k views

Update Top 1 Row In SQL Server

I know that typically you would have an autonumber field - but in this instance there is not, and it honestly does not matter which row get's updated as long as it is only 1. I have sample DDL like ...
0
votes
1answer
196 views

Regular Data Space Specification vs Text/Image Filegroup

I want to change the FileGroup of a table for FG01 to FG03 . but in properties of table there is the Regular Data Space Specification and Text/Image Filegroup which have the list of FileGroups, what ...
-2
votes
2answers
64 views

How do I create a new common date field based on 3 yr-mth fields?

Here is my sample data: ID | Load Dt | Start Dt | Complete Dt ----+------------------+------------------+------------------ 1 | 3/2/2017 9:17 | 6/8/2017 9:59 | 6/8/...
0
votes
2answers
73 views

Create Table Every X Rows

I have a SQL Table that we are selling off some of the data, so I need a quick way of splitting the main table into sub tables every 50 rows. Table nomenclature does not matter, I am just stuck on a ...
0
votes
2answers
120 views

Clustered indexed fields hash matching. Does it matter?

I'm trying to performance tune some lengthy queries and I'm slicing bits out and running them in isolation. The query below features three tables D500M, D550M and D580M, all joined on person_ref. All ...
1
vote
1answer
304 views

How to get top 1 row for each of the state in USA

I have a list of states in table 1 (Statename, StateAbbreviation) I have different city based records having StateAbbreviations in table 2 I want top 1 record per state from table 2 My result should ...
-1
votes
1answer
68 views

Best pratice to update blank values to null

I have a table like this: | COL1 | COL2 | COL3 | COL4 | COL5 | |---------- |----------- |-------- |-------- |------ | | 20170302 | 5693153.2 | 0 | 3.0665 ...
2
votes
0answers
71 views

Linked servers not ignoring case after reboot

We have a SQL Server 2014 database with collation SQL_Latin1_General_CP1_CI_AS, which is case insensitive. It is linked to another SQL server database with the same collation. The second database ...
9
votes
1answer
2k views

Daylight Saving time

In my environment, there are servers running on native backup and Ola Hallengren plans. Our servers are a combination of 2008, 2012 and 2014. All the full backups are taken at 12am and log backups are ...
2
votes
1answer
144 views

Ideas how to make this query faster?

I have the following query: SELECT TabPohybyZbozi.ID, TabPohybyZbozi.NazevSozNa2, TabZakazka.Nazev, TabDokladyZbozi.DatPorizeni, TabPohybyZbozi.IDDoklad FROM ...
1
vote
0answers
2k views

SQL Server Database Engine cannot obtain a LOCK resource at this time

I've recently started getting this error : Msg 1204, Level 19, State 4, Line 1 The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement ...
3
votes
1answer
521 views

T-SQL: CSV->table pipeline with custom parsed numeric data, lookup values

Problem Wish to insert thousands of records into a table [Child] from a CSV file (and do this from tens of files into the same table). However, I want to A. substitute a lookup value into the table (...
1
vote
0answers
52 views

Determine tables / query from Missing Join Predicate event

On SQL Server 2008, in the profiler, I have a Missing Join Predicate event class that happened at 3:30am StartTime. How do I get more information? What query was being executed, or tables were being ...
0
votes
0answers
300 views

exec sp_execute followed by an int and other parameters?

I'm trying to figure out what is running on a SQL Server 2008 machine. When I profile the server the RPC:Starting shows various text data like this: exec sp_execute 26,147964,122,N'43398.jtk' exec ...
2
votes
1answer
110 views

SQL Server: test # of partitions == partition_functions.fanout

I am attempting to write a test for already partitioned schemas. The test should confirm that each schema was partitioned # number of times where # = sys.partition_functions.fanout. I have found ...
1
vote
0answers
147 views

SQL Server Configuration Manager: Error 0x800706be

Running a computer with SQL Server 2012 Express installed. Just installed SQL Server 2008 Express and updated to SP3. Also have installed SQL Server 2008 R2 Express and updated to its SP3. Opened ...
3
votes
2answers
698 views

Why should I install both 32 and 64 bits Oracle provider for the same machine?

I needed to read an Oracle DB from SQL Server, so I had to install the Oracle provider (ORAOLEDB.Oracle). My machine: System: Windows Server R2 2008 Enterprise, 64 bits (SP1). RDMS: Microsoft SQL ...
1
vote
2answers
99 views

Customized date range in sql

We have got a customized quarter list from client which we need to take reference to get data in SQL. Could you please help. 30-Oct 29-Jan AS Quarter1 30-Jan 30-Apr AS Quarter2 01-May 30-Jul AS ...