This tag is for SQL Server 2008, major build version 10.00.xxxx.

learn more… | top users | synonyms (1)

2
votes
2answers
113 views

How to get OUTPUT $action, Inserted.*,Deleted.* records in In SSIS

I was just wondering, in MERGE in T-SQL, you can output the OUTPUT $action, Inserted.* and Deleted.* records. I want to ask how can I get OUTPUT $action, Inserted.*, Deleted.* records in SSIS?
0
votes
1answer
45 views

SQL Server 2008 and constant expressions

If I have the following scenario, would Replace be evaluated a single time? DECLARE @text nvarchar(32) = 'This is a test field' SELECT textField FROM Table WHERE Id = @idICareAbout AND textField = ...
3
votes
1answer
28 views

How to only restore a specific filegroup?

I am using SQL Server 2008R2 (but I can upgrade if necessary) I have a database with multiple schemas and each schema is on a different filegroup (I wish I could just backup/restore a schema but that ...
0
votes
1answer
34 views

Restore Database with Multiple Restore commands

For automation, I have to dynamically construct the restore commands and thus I have created a script. A .bak file is created on a remote server and I receive it daily. The script builds the restore ...
-1
votes
1answer
59 views

How to aggregate related rows

I want to group these related rows into trips (where each trip consists of a sequence from point 1->2->3->2->1). route Date time ------------------------------- point1 15/10/2014 ...
1
vote
1answer
65 views

Unable to restore database

I am trying to restore several databases and I have no clue why some of them fail with the following error: Msg 3634, Level 16, State 1, Line 1 The operating system returned the error '1244(The ...
0
votes
0answers
27 views

Error while configuring mirroring, Microsoft SQL Server, error : 1418

I have a SQL Server 2008 Enterprise SP1 installed on my both principle and mirror server. SQL Server and SQL Server agent service is also started by same ID having sysadmin rights. But when I am ...
1
vote
1answer
35 views

Changing Column type to avoid Arithmetic overflow error

I have a table that saves user hits. It has these columns: ID , UserID , HitDate , Userlocation , UserUniqueID Today I'm getting this error "Arithmetic overflow error". After I checked it out I ...
0
votes
1answer
48 views

Working out Duplicated Data in a Customer Data Base

I have a database in SQL2008 of customers, There is an ID number for the customer. What im trying to do is to create a NEWID field. We have duplicated customers that have different ID fields, I am ...
2
votes
1answer
40 views

Restore database with different filename

I have to restore a new back up file daily (as an agent job, after first deleting the existing db) but the file name will vary as it will include the timestamp as well. How can I achieve this so ...
1
vote
1answer
32 views

Minimum SQL Server rights that allow viewing column default values

I have an SQL Server 2008 database, some of the fields (columns) in some of the tables are configured with default values. I have a requirement to limit user security as much as possible, ideally ...
0
votes
3answers
111 views

Split date/time range into day ranges [closed]

Using this data (also shown in this fiddle): create table dbo.records ( id int not null primary key identity(1, 1), startdatetime datetime not null, enddatetime datetime not null ); insert ...
0
votes
0answers
17 views

Altering the size of user defined datatype in SQL Server

I had created the user defined datatype varchar(5)..But now i have to change the size as varchar(10)..the thing is the udd is used in many tables.. can anyone help me to change the size without using ...
0
votes
0answers
50 views

Accidentally deleted records in MS SQL Server 2014

I have a very big problem with SQL Server data lost. Recently, i have performed SQL replication. and i found out that all exising records/rows in the subscriber was totally erased and replaced by the ...
0
votes
0answers
14 views

SQLServer dependency graph and performance

I have a large stored procedure running on SQLServer2008 to produce a report on the previous day's data. It rehashes data from 12 tables, including a lot of ORDER by date and CASTS. Among others, it ...
1
vote
1answer
23 views

how to included concatenated values in Dynamic Pivot Column Value

I am extending a dynamic pivot query. The original query works fine. In the second query Instead of display the date as a value for the pivot column I would like to display a concatenated column ...
-1
votes
1answer
35 views

Is there a way to copy/initialize values in a set

What I want to do (I know this does not work) is: update stats set BandwidthLastMonth = BandwidthThisMonth, BandwidthThisMonth=0 where myPk = 3 Is there a way to do this in a select ...
0
votes
1answer
33 views

How to add a default null row if no results from the dynamic pivot query [closed]

I execute this procedure and display results in my application. If my query does not return any results, I still need to print out the column headers and since its a dynamic query I cannot hard code. ...
0
votes
2answers
32 views

Error with making backup in sql Server

We have a win server where installed sql server 2008. When I try to backup database, I have an error. Is anybody know what is the error? TITLE: Microsoft SQL Server Management Studio ...
0
votes
1answer
23 views

How can I get all rows of data not included in a TVP

I am trying to do the following: declare @domains DomainNames; declare @CompanyId int declare @CompanyName varchar(255); declare @deletedList DomainNames; set @CompanyId = 239; set @CompanyName = ...
1
vote
1answer
35 views

How can I get a local variable that's a list in a stored procedure?

I have some code in C# I'm trying to move to a stored procedure - Sql Azure does not like multiple calls. So everything needs to get moved to a proc. Here's the C# code: List<string> ...
2
votes
1answer
87 views

varchar storage and comparisons in SQL Server 2008

I have a large table with a structure similar to this: Id bigint primary key Sequence int Parent int foreign key Data1 varchar(20) Data2 varchar(20) Data3 varchar(20) Data4 ...
1
vote
1answer
34 views

Choice of clustered key when almost all columns would be part of a unique index anyway

I am creating the following table CREATE TABLE dbo.COMM_SHELF_BLOCK_ACCESS ( KeyId uniqueidentifier NOT NULL ROWGUIDCOL CONSTRAINT DF_COMM_SHELF_BLOCK_ACCESS_KeyId default NEWSEQUENTIALID(), ...
0
votes
2answers
50 views

How to set host_name() value in a Sql Server Stored Procedure?

We have existing triggers which read the workstation id property of the connection string using host_name(). There are existing PowerBuilder client applications connecting to the database directly ...
1
vote
2answers
63 views

SQL Server report based on stored procedure not showing columns

I'm working in SQL Server 2008 R2. Created a stored procedure (EXEC dynamic SQL with CASE THEN ELSE ) on server with parameters works ok. But Report Builder on insert table is not showing columns for ...
1
vote
1answer
45 views

how to group data against more than one conditions

I have a table named Employees with below two columns. ================== Employees 1- EmpId (auto incremental id) 2- EmpName (varchar) There is another table named 'LateDays' with below five ...
1
vote
3answers
46 views

Restoring SQL Server database with CDC

I want to perform a database restore on SQL Server 2012 and copy the database to a different server. CDC is enabled on the original database. I have managed to copy the database along with the CDC ...
2
votes
1answer
37 views

Create failed for Availability Group 'AGN'

I tried creating availability group (AOH) many times but no luck , It got failed every time. Please help me on this case. I configured Windows cluster (Name as 'WINCLUSTER') with two nodes. They are ...
0
votes
0answers
54 views

Prevent gaps while using Identity/sequence object in sql server

I have a table and I am trying to insert values in it. I want to prevent gaps in the primary key column. For primary column I have tried using Identity / sequence objects. I know that this is ...
4
votes
1answer
94 views

How to determine if insert or update

Whenever INSERT is happened in the CUSTOMER table,I need to call the "StoredProcedure1"and UPDATE is happend in the CUSTOMER table,I need to call the "StoredProcedure2" in the Trigger. How to ...
0
votes
4answers
82 views

SqlServer: can one table's PK be the FK of other two table's? [duplicate]

I have three tables project, users and proj_user. The PK of proj_user table is the FK of project and users table's pk e.g.(project_id,user_id) My question is, is it possible for the project_id and ...
-2
votes
1answer
52 views

SQL Server procedure optimisation

I need to optimize the procedure below (SQL Server 2008) and badly need help: I am thinking to reduce search space o Splitting the joins and create intermediate (smaller) results o Force the most ...
0
votes
0answers
21 views

Exporting data using SBIDS

I have created lots of SQL reports using Microsoft Visual studio (from BIDS as part of the SQL package). I am running 2008R. When I export the data I would like to export to Access instead of the ...
0
votes
0answers
34 views

Measure fragmentation of a single index?

We are measuring the impact of different defrag approaches that we do one index at a time. How do we query to see fragmentation of a single index, by index name (or table + index). This is on SQL ...
1
vote
2answers
193 views

What is causing my Transaction log to grow

The TLOG in my SQL Server 2008 is growing faster than usual. The DB has a Full recovery model and we have a TLOG backup every hour. Can you please write me or refer me to link that describes a way to ...
1
vote
1answer
65 views

Dynamic Number of Columns in Pivot Table

I have a table to store StudentID, SubjectID, ObtainedMarks. Now I have to create a pivot table to show studentID and obtainedMarks in different subject. Number of subject may differ. I could generate ...
2
votes
1answer
46 views

convert string allow null col to int?

I want to convert string to int my string type [DT_WSTR] and my expression ISNULL(col) || TRIM(col) == "" ? (DT_I4)0 : (DT_I4)col I get this error [Derived Column [518]] Error: The conditional ...
0
votes
0answers
5 views

Linked Server from SQL Server 2008 to Oracle not working

I have tried to make a linked server from SQL server 2008 to Oracle Server. I have successfully made a Linked Server from another machine to that oracle server but the one I'm making on my machine ...
2
votes
1answer
176 views

Why dropping all foreign keys from a script is not working? [closed]

I have sysadmin rights on a SQL Server 2008 R2 box. I found a script that can drop all foreign keys and re-add them for us when we need to after a testing import. So I execute the below code with no ...
0
votes
1answer
83 views

How to schedule jobs in Sql server 2008 for less than 10 sec?

I want to run a job every 3 seconds, however in SQL Server 2008 we cannot define an interval of less than 10 seconds. The job is used to insert/update visitor information, and segmentation ...
0
votes
2answers
57 views

Auditing the View Server State permissions on Server

We noticed that one of our servers has permissions granted to "all" users for "view server state". I am wondering if there is a way to audit the DMV's used by the user(s) on a regular basis as this ...
0
votes
0answers
24 views

SQL named instance cannot be connected by a specific user

SQL server 2008 R2. It has default instance running and a couple of named instance. - I can connect to both default instance and named instances. - User can connect to default instance but he is not ...
1
vote
0answers
39 views

What will do After Press F5? [closed]

select * from Employee; Name id Col1 Col2 Row1 1 11 1 Row2 2 12 3 Row3 3 13 30 Row4 4 14 44 Above is my table After PRESS F5 What process is running in Background ...
0
votes
1answer
39 views

How to choose suitable naming convention for Dimensional Table Column in a Data Mart?

I have done a lot of reading on naming columns for use in a data mart / data warehouse, as well as for general programming usage. For example, if I had a business branch in a normal application I ...
0
votes
1answer
49 views

How do I backup/restore database encryption key in order to restore on new server

I am currently in the process of restoring a TDE encrypted database to another instance. I have backed up master key and certificate, and have restored them to the new server fine, but I am still ...
1
vote
1answer
95 views

AWE to allocate memory in SQL Server 2008 Express with Advanced Services

I am running SQL Server Express Edition with Advanced Services on Windows Server 2008 Enterprise 32 bit OS. I have enabled "Use AWE to allocate memory" on the SQL Server, but I am not sure if this ...
0
votes
0answers
23 views

Import from one table in two tables where I need the auto-generated primary key in the second table

followning scenario: 3 Tables 1 Table name,street,country,bank This table needs to be imported to Table1 Address(Primary Key Autoincrement ID),name,street,country Table2 Address,bank So I need ...
0
votes
1answer
66 views

How can I reseed all identity columns?

I deleted all rows from 20 tables after disabling the constraints, triggers using the stored proc SP_MsForEachTable. Now before the import happens, I need to reseed all the identity columns back to ...
1
vote
1answer
57 views

SQL Server 2008 R2 - Access Failure in a query that uses Linked server

We have 2 SQL Server 2008 R2 machines. A user is running a query on Server A that joins a table in Server B. In the query he is using linked server to point Server B. User has access to Server B ...
1
vote
2answers
45 views

Merge Table Row Values to Header of Another Table

Table 1 id | Field | Values ---------------------------------------- 1 | 'Field01' |Name 2 | 'Field02' |Age 3 | 'Field03' |Gender 4 ...