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

learn more… | top users | synonyms (1)

1
vote
1answer
18 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 ...
2
votes
3answers
606 views

Twice job results in sql server, last one is left in progress

I have the job MP - Create CSV which execute a package SSIS in sql server 2008, when I check for the job history I see the result at step 0, I expand and I have 2 results for the step 1. Fist result ...
1
vote
1answer
101 views

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

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 ...
3
votes
1answer
416 views

SQL Server Troubleshooting Replication and Long-Running fn_dblog query

I am trying to get (pull) Transactional Replication working again for a subscriber. Currently, in Replication Monitor I am seeing messages in the Publisher to Distributor tab and the Distributor to ...
5
votes
5answers
28k views

Writing select result to a csv file

We need to write the SELECT query results to a csv file. How can it be done using T-SQL in SQL Server 2008 r2? I know that it can be done in SSIS, but for some reasons, we don't have this option. I ...
0
votes
1answer
64 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 ...
3
votes
3answers
4k views

How to get last identity row Inserted when using instead of trigger

When I inserted on tables that exists instead of triggers on those. @@Identity , IDENT_CURRENT('Table') and SCOPE_IDENTITY() return null. How I can get last identity of inserted row
0
votes
0answers
20 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 ...
3
votes
1answer
262 views

SQL Script to Drop old AD logins, Inactive SQL Logins and all related Users

Related Question: SQL Server script to delete accounts no longer in Active Directory Whilst the above question points out the rather handy sp_validatelogins procedure, i'd like to extend this ...
0
votes
1answer
22 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 ...
1
vote
0answers
36 views

What will do After Press F5? [on hold]

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
69 views

How to generate replication snapshot without locking tables

When I reinitialize subscription and generate new snapshot it locks all tables and makes the database unusable for a very long time (never waited it out). Is there anyway to do this without locking?
1
vote
2answers
291 views

Optimizing SSIS Packages

I have a SSIS package that loads data in an Access DB to tables on a SQL Server DB. Currently I double click the package and execute it. There are times when there is a lot of data to load. My ...
1
vote
1answer
53 views

Print the execution time on messages Pane?

How I can print the execution time of each query on messages Pane? For example the Select * from tbl1 runs for 10 mins then Select * from tbl2 runs for 15mins and so on.. Select * from tbl1 Go Select ...
1
vote
1answer
76 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
1answer
40 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
42 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 ...
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
47 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
2answers
43 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 ...
1
vote
2answers
101 views

Proper Shutdown of SQL Servers in a Cluster

I was just wondering what the best approach should be for shutting down an Active/Active Cluster where both nodes need to be shutdown for disk maintenance. I was thinking of this process: Open ...
3
votes
5answers
2k views

User Windows login name has been changed in AD yet session in SQL 2008 Profiler shows the old Windows login name

Background: a user had her name changed in Active Directory from Domain\oldname to Domain\newname and successfully logged into the network with Domain\newname and yet Domain\oldname appears in ...
3
votes
1answer
148 views

Updateable Subscriptions: Rows do not match between Publisher and Subscriber

I have transactional replication with updatable subscribers set up in SQL Server 2008. It has 3 subscribers and 1 publisher. I had to setup replication again due to some errors related to the database ...
0
votes
1answer
28 views

export and import all the permissions on schema objects within a database SQL Server 2008

Is it possible to export all the users roles and their permissions on schema objects within a database in a .sql file and import them later in an other database ?
3
votes
2answers
915 views

Problem with Czech collation Czech_CI_AI in MS SQL Server 2008 R2

I have the following issue with accent insensitive search in Czech language. My database is set to Czech_CI_AI collation. For some diacritics system works correctly (ie. I), but for some does not (ie. ...
3
votes
2answers
1k views

On SQL Server Backup: Msg 3271, Level 16, State 1, Server Line 1 A nonrecoverable I/O error occurred on file

I am trying to back up a pretty big database and I keep getting this error: Msg 3271, Level 16, State 1, Server {Server Name}, Line 1 A nonrecoverable I/O error occurred on file "{Backup File ...
1
vote
1answer
42 views

How Does Max Server Memory Affect PLE on a Host That Is Not Memory Bound?

I came across an unusual scenario on an instance where only half the physical RAM was being utilized but I was observing PLE values between 1-3 seconds constantly. Windows Server 2003, Enterprise ...
1
vote
1answer
65 views

Operand type clash: my first User Defined Type with list of Integers, how to test via SSMS

I found this wonderful code here CREATE TYPE [dbo].[StringList] AS TABLE( [Item] [NVARCHAR](MAX) NULL ); GO CREATE PROCEDURE [dbo].[sp_UseStringList] @list StringList ...
1
vote
2answers
42 views

Merits of inserting to temp table and renaming versus just adding/removing columns

If I add or drop columns from a SQL Server table I presume I get page splits or gaps. Since the size of the row has changed. When I use RedGate SQL Compare to create conversion scripts its strategy ...
-1
votes
0answers
24 views

Does a DELETE/UPDATE query based on a large SELECT query cause deadlocks and can it be improved?

I've noticed DELETE and UPDATE queries that are based upon a large SELECT statement such as NOT IN (SELECT ID FROM LARGE_TABLE) are often ending up with deadlocks. Is this causing deadlocks and if so ...
4
votes
3answers
2k views

What would cause an orphaned ##MS_PolicyEventProcessingLogin##?

This morning I noticed my SQL Log was filling with the following message. The activated proc '[dbo].[sp_syspolicy_events_reader]' running on queue 'msdb.dbo.syspolicy_event_queue' output the ...
0
votes
2answers
80 views

can we transfer sql database backup from one server to another server directly?

I want to transfer sql database from one server to another server directly, instead taking back up of that database and copy that back up in another server and then restore it. Please tell me, Is ...
1
vote
1answer
72 views

SQL Server 2008 logging [closed]

We have a SQL server that has been hardening per government STIGs. Right now we are generating almost 10GB of Transaction log every day. (run sharepoint and some other applications). I'm trying to ...
2
votes
1answer
137 views

Find if Column Belongs to User Table

I want to compute the number of columns with not null constraint in my database. So I thought about querying the table sys.all_columns: select * from sys.all_columns The problem is that it ...
1
vote
2answers
4k views

How to Drop Database in Single_User Mode

How do I drop a database which shows DatabaseName (Single User) as its name? When I try to delete it, I get the following error: Alter failed for Database 'DatabaseName'. ...
0
votes
1answer
21 views

equivalent of oracle sql administration query in SQL Server 2008

I'm new to SQL Server administration, and I would like to get the equivalent of this Oracle 9i administration query : select object_type,count(*) as number from all_objects where owner='ownerSID' ...
0
votes
1answer
20 views

Need to Display Query Result without Null Values in one column

I created a query which produced four column result, I wanted to display result in which the Outstanding column > 0. My query below: SELECT CAST(xx_master_tickets.CreatedMoment AS DATE) ...
1
vote
2answers
46 views

Defragmentation of Indexes - Higher value after defragmentaion

I am trying to defragment indexes on SQL Server 2008 using ALTER INDEX--REBUILD. After defragmentation some indexes have fragmentation percentage value greater than its before defragmentation value. ...
0
votes
1answer
70 views

dbcc shrinkfile not reducing size of log file in sql server 2008

I am shrinking log file of SQL Server 2008 R2 database, but it is not working. I was using this code: ALTER DATABASE [database] SET RECOVERY SIMPLE DBCC SHRINKFILE(DATABASE_LOG, 20) ALTER DATABASE ...
0
votes
1answer
41 views

reuse of temp table getting more time to execute

i'm creating temp table as, SELECT T.CD, T.OBJECT_CD, T.PRICE INTO #TEMP FROM TABLE_NAME T EDIT : ADDED CLUSTERED INDEX TO TEMP TABLE CREATE CLUSTERED INDEX IX_Temp_OBJECT_CD ...
2
votes
1answer
6k views

UPSERT - Is there a better alternative to MERGE or @@rowcount? [closed]

I was wondering if you have encountered a T-SQL command similar to the concept of UPSERT? Performing INSERT|UPDATE operations using options (1) or (2) seems overly complex and error prone. OBJECTIVE ...
1
vote
5answers
3k views

How do I restore a SQL Server 2000 database to a SQL Server 2008 instance?

How do I restore a SQL Server 2000 database to a SQL Server 2008 instance?
4
votes
2answers
1k views

Error installing Microsoft SQL server 2008 R2 with tools! Error code

When trying to install SQL Server 2008 R2, I get the following error: Error installing Microsoft SQL server 2008 R2 with tools! Error code: -2068578303 Does anyone know what this means?
-1
votes
1answer
33 views

Issues with procedures, setting multiple values [closed]

I am trying to set multiple values but I am only able to set one value. This code fails: alter procedure modifyvalue @ID int, @flight varchar(6), @destination char(10) as begin update ...
1
vote
2answers
88 views

Insert Missing Dates from a query

How can i insert missing dates from a query i created. The result below: Date Frequency 2014-05-18 5 2014-05-20 7 2014-05-25 7 2014-05-27 6 I want the result to have missing ...
1
vote
1answer
144 views

View the order of triggers firing

We have 2 SQL Server 2008 environments with some triggers against a table containing business logic Within the 2 environments, we can see that the triggers are firing in a different order (thanks to ...
9
votes
6answers
2k views

SQL Server command line usage? Is it possible?

I've been trying to use the SQL Server Management Studio 2008's built in "Solution Explorer" to manage a project and after 2 weeks of struggling with it, I've decided I don't really care for it. It's ...
8
votes
5answers
613 views

SQL Server 2008 and extended properties [closed]

In SQL Server, what do you guys use extended properties for? Some articles and blogs are suggesting they be used for self-documentation of the database and its objects but I can't see this being used ...
1
vote
1answer
359 views

Increasing time-out period for schema compare (windows server 2008, Sql Server 2008 R2 and VS2012)

I need to increase the time-out period for schema comparisson using visual studio 2012 to compare two sql server 2008 r2 database on a windows server 2008. I believe this is somenthing I need to set ...
0
votes
1answer
147 views

Copy+Pasting currency value from SSMS 2012 to excel does not complete or calculate new value

So I'm trying to copy and past some query results into excel, and for some reason it seems to be not properly completing the first value. Let me explain what I mean by this. In excel the cells I am ...