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

Missing Encryption Key when migrating Reporting Services from SQL Server 2008 to SQL Server 2016

Owing to a ransomware attack on our production server Reporting Services went down. This server was installed few years ago and its been in production for long. We have quite a few reports on this ...
1
vote
1answer
56 views

Conversion of Row into Column

I'm in very weird situation and i have researched a lot but not able to find anything similar to this scenarios. Input looks something link this. Where Each patient has Primary Dx code, Admit Dx ...
1
vote
1answer
53 views

Convert SQL Server results to a text file that PowerShell can access and use

The query below is used to create a text file with a list of server names. The problem I have is that the text file gets created like Server, Server, Server etc. but I need it as follows Server ...
17
votes
2answers
31k views

Tracking stored procedure usage

Besides using SQL Server Profiler, is there any way to track which stored procedures are being used, or at least when they were last executed?
0
votes
1answer
11 views

Multiple inserts using select row and variable combination with one SQL statement

I'm working with SQL 2008 R2 and have a need to find a specific row in a table that has three fields and then insert multiple rows into the same table with each insert using two values from the found ...
1
vote
1answer
55 views

I want to change to Dynamic SQL Query instead of CASE statement [on hold]

I have two tables as below and description is given in below Employee table id EmployeeID departmentid department1 department2 department3 1 300 100 IT Finance ...
-1
votes
1answer
25 views

SQL Admission Count using row_number

I'm new in SQL Server learner and I'm stuck in simple problem to count the admission using SQL Server in healthcare data set. Sample table: create table admissions ( HIC char(1), DateFrom date, ...
3
votes
2answers
14k views

How to install SQL Server Management Console in 2008 Express Version?

I started a dozen attempts to install the SQL Server Management Studio for the 2008 Express Version of SQL Server. What i use: Windows Vista 2007 SP 2 What i did: a) I downloaded the install file ...
6
votes
1answer
553 views

Why am I getting the error “non-boolean type specified in a context where a condition is expected” for this request?

I am getting this error : "Error 102 : non-boolean type specified in a context where a condition is expected" for this request : DECLARE @num_dossiers TABLE (num_dossier INT,indice NVARCHAR(3)) ...
0
votes
0answers
47 views

Why can't SQL Server handle into's in 2 parts of a script? [duplicate]

I noticed some behavior I found weird while editing a co-workers stored procedure: create procedure weird_behavior (@switch bit) as if (@switch = 0) begin select * ...
-1
votes
0answers
19 views

Compare 500 files and load only distinct record

I have 400 to 600 different files and with same data type. But in these files, we have so many duplicates record in all the files. In my folder, there are A.txt, b,txt, c.txt files are there. It ...
4
votes
1answer
531 views

Converting Monthly Rolling SUM (YTD) back to Monthly numbers

I'm having a problem converting rolling SUM by month (monthly year to date) back to only that month's numbers. For example, see table below. Periods are (YYMM) and a monthly period per year starts ...
2
votes
1answer
189 views

Table Fragmentation

If I execute the following: SELECT dbschemas.[name] as 'Schema', dbtables.[name] as 'Table', dbindexes.[name] as 'Index', indexstats.alloc_unit_type_desc, indexstats.avg_fragmentation_in_percent as ...
2
votes
1answer
19k views

Database 'msdb' cannot be opened. it has been marked suspect by recovery

I'm using SQL Server 2008. I got suddenly today an error while i was accessing a database from Visual Studio. The error is: Database 'msdb' cannot be opened. It has been marked SUSPECT by recovery. ...
0
votes
3answers
1k views

Find constraint disabled in SQL Server

I'm doing an audit of constraints in SQL Server. How to find all constraints that are not enabled? This, after using the next declaration: alter table mytable nocheck constraint all
3
votes
5answers
416 views

Order table by two columns

I would like to order this table but I can not find a way to make it work. Can you help me? I have this table: I need this: I have a table where documents are listed, the first field is the id of ...
7
votes
2answers
2k views

Why is my log file so massive? 22gb. I am running log backups

I can't seem to figure out the answer. I've seen multiple answers like this: Why Does the Transaction Log Keep Growing or Run Out of Space? and everyone talks about running back ups on your log file ...
6
votes
7answers
40k views

Error: Cannot Generate SSPI context

When someone tries to connect to a SQL Server instance, the error shows up: It's not possible do generate SSPI context. Yesterday we had a blackout (don't know how to say this expression in ...
1
vote
1answer
90 views

How to make this Cursor work better

I have a table and I am trying to apply payments to the loan amounts. Payments must be applied to initial loan until it is zero before going to next loan. First I must say cursors are not my strong ...
1
vote
0answers
25 views

SSMS - Data load Option

I have recently installed the newer version of SSMS on my system. But the option to load the excel file is grey out. I'm not able to load BULK Load I tried to run DTSWizard.exe, even it doesn't give ...
12
votes
5answers
5k views

Accidentally turned down SQL memory too low to log in, how do I fix?

I turned down the Maximum Memory of the my SQL Server instance to 15 MB... Now I can't log in to increase it. How can I increase the maximum memory without logging in? Version is SQL 2008 R2
22
votes
2answers
25k views

Performance difference between Clustered and Non Clustered Index

I was reading Clustered and Non Clustered Indexes. Clustered Index - It contains Data Pages. That means the complete row information will be present in the Clustered Index Column. Non Clustered ...
36
votes
7answers
206k 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 ...
54
votes
7answers
49k views

Writing a simple bank schema: How should I keep my balances in sync with their transaction history?

I am writing the schema for a simple bank database. Here are the basic specifications: The database will store transactions against a user and currency. Every user has one balance per currency, so ...
2
votes
2answers
5k views

CMDEXEC The process could not be created for step… (reason: Access is denied). The step failed

I have created a job to test executing a CmdExec step. The job step is simply executing a batch file with dir as the command. The job is executing as the SQL Server service account. This account ...
0
votes
0answers
36 views

Loading 'Image Service Package' crashes Management Studio

I'm getting the following error on my SQL Server when I log into the system: I ran a repair on SSMS successfully, but it did not resolve the issue. The following error message is recorded in Event ...
9
votes
1answer
806 views

Minimal Logging Conditions in SQL

I have written a script to test out the claims made on this page http://technet.microsoft.com/en-us/library/dd425070(v=sql.100).aspx in the table titled Summarizing Minimal Logging Conditions about ...
7
votes
4answers
55k views

Select multiple values in LIKE Operator

I have a SQL query given below, I want to select multiple value using like operator. Is my Query correct? SELECT top 1 employee_id, employee_ident, utc_dt, rx_dt FROM employee INNER JOIN ...
1
vote
1answer
99 views

MS SQL 2008 Databse in Suspect mode and CHECKDB returns error: Object ID 3 has chain linkage mismatch

We did a disk expansion for VM DB server. However, after this operation the DB became suspect mode and cannot be open. Then we tried somethings like that; https://www.sqlrecoverysoftware.net/blog/...
-2
votes
1answer
117 views

DBCC CHECKDB last good date

SQL Server 2014 Standard. Using Ola's (blessings be upon him) scripts to perform database integrity checks: Job command: sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[...
0
votes
2answers
50 views

How to grant or allow a particular SQL Server Login/User to always view a Column Level Encrypted data?

I used Column Level Encryption to encrypt one of the columns in my SQL Server database. Now everytime I want to SELECT to see that encrypted data, I have to open the symmetric key to decrypt the ...
1
vote
1answer
35 views

SSMS is crashing and SSMS Toolbar

I'm new in SQL Server and i have installed SQL Server on my system for testing purpose. Issue 1: I want to convert the name of all the toolbar in menu tab to icon. I have no clue from where does it ...
1
vote
1answer
116 views

Why is FORCE JOIN option slowing down query and forcing execution plan to sort prior to joining tables?

I'm linking Orders data with the Results data for those orders. Here's the SQL query for joining and selecting the ; with orders as ( select o.*, otr.*, oo.* from Order o inner join ...
4
votes
2answers
3k views

msdb.dbo.sysjobs and last run date and time

I know that the last_run_date and last_run_time are stored as Int, but when coverted over to datetime (of which I have examples of), is the time GMT, or what? When converted it doesn't match the same ...
0
votes
2answers
37 views

Disk Separation DB installation and data files

I am wondering whether it is a good idea to separate the database installation media from the actual data files. In our current environment we have: C: - Windows Server D: - MS SQL Installation &...
0
votes
1answer
30 views

SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'

Whats wrong with this statement? why it gives below error message Error Message: SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET ...
0
votes
1answer
31 views

Joining on empty rows

I've got two tables. | tbAccountValues | +-----------------+ | Branch | Month | Values | +--------+---------+--------+ | 0001 | January | 1000 | +--------+---------+--------+ | tbMonths | +----...
0
votes
1answer
54 views

Using Cursor to loop through a Table variable in SQL Server

I have a parameter in the Stored Prod which gets some data in the format 1/1/2018-2/1/2018,2/1/2018-3/1/2018,3/1/2018-4/1/2018,4/1/2018-5/1/2018,5/1/2018-6/1/2018,6/1/2018-7/1/2018,7/1/2018-8/1/2018,...
22
votes
2answers
74k views

'CONCAT' is not a recognized built-in function name

A client reported that they were running on SQL Server 2012, and we delivered some test queries for testing prior to a final delivery, however: 'CONCAT' is not a recognized built-in function name. ...
1
vote
2answers
53 views

Is it possible to run query against only part of the Central Managed Servers?

For example, I want to run this query to get the status of some servers having high availability group set up: SELECT s.role_desc, g.name, r.replica_server_name , GETDATE() as checkTime FROM ...
9
votes
2answers
40k views

SQL join query to show rows with non-existent rows in one table

I am trying to get some reporting done for employee time records. We have two tables specifically for this question. Employees are listed in the Members table and each day they enter time entries of ...
2
votes
1answer
50 views

Auto generated statistics by query optimiser

Can we consider removing the auto generated statistics if the update statistic within a given database is taking too long? We do a weekly maintenance using UPDATE STATISTICS WITH RESAMPLE but often ...
46
votes
8answers
98k views

How do I shrink all files quickly for all databases?

In SQL Server (2008 in this case) how can I quickly shrink all the files, both log and data, for all databases on an instance? I could go through SSMS and right click each and choose Tasks -> Shrink, ...
19
votes
5answers
5k views

Is ROLLBACK a fast operation?

Is it true that RDBMS systems are optimized for COMMIT operations? How much slower/faster are ROLLBACK operations and why?
3
votes
3answers
511 views

Transaction log reported full but is not

Batch jobs error emails report: The transaction log for database 'WebDB' is full. No, it isn't. Its 90% free. The transaction log backups run normally. My hardware guy tells me the hardware is ...
10
votes
3answers
13k views

Grouping records based on intervals of time

I have a table with the following schema, and I need to define a query that can group data based on intervals of time (Ex. records per minute) and then provide the sum of the changes to the ...
1
vote
1answer
54 views

Comparing two pairs of columns between two tables and returning the column from a third table

I have three tables: Table1 table1 can have anywhere from 50K to 800k unique rows. By this, I mean that the combination of all the values in each row are unique, although sometimes, some columns ...
1
vote
1answer
206 views

SQL log directory has too much dump file

My SQL Server 2014 is automatically creating SQL dump file. It is generating automatically to take all the spaces and hangs over the database. Error: 8310, Severity: 16, State: 1. Cannot create (...
0
votes
1answer
31 views

Sql selection of text file

I am new in SQL and need a small help in solving this. I have a column which has a file path name "C:\Users\akumar\Desktop_Claim Files\AMSO_CLAIMS_YYYYMMDD.txt". And, I need to create a column (...
2
votes
1answer
73 views

Added .Net assembly to SQL CLR without turning TRUSTWORTHY ON

I'm trying to add "System.Messaging.dll" using the guidance provided by Solomon Rutzky in his post Assembly deployment with permission UNSAFE or EXTERNAL_ACCESS using asymmetric key but I'm failing at ...