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.

-7
votes
0answers
33 views

Anyone can help me suggest or give a sample query to generate this sample output in sql server or mysql database [on hold]

Anyone can help me suggest or give a sample query to generate this sample output in sql server or mysql database
0
votes
1answer
25 views

error 15466 An error during decryption

I have a stored procedure that runs xp_cmdshell with a user with sysadmin right.(it was created by someone else long time ago). For security purposes I need to remove the sysadmin right from this user....
0
votes
0answers
24 views

SQL Server upgrade advisor reserved keyword warning - Can't find keyword!

I am running SQL Server 2008 Upgrade Advisor tool on a SQL Server 2000 DB, and the final report shows an error: Database Server,"PreUpgrade", "After upgrade, new reserved keywords cannot be used ...
0
votes
1answer
27 views

Why does sql server have a hard time rounding floats?

if exists (select 1 from sys.tables where name = 'd_ratio') begin drop table d_ratio end if exists (select 1 from sys.tables where name = 'elrd') begin drop table elrd end CREATE TABLE [dbo].[...
1
vote
2answers
31 views

Simple confusion with DATALENGTH()

DATALENGTH() function returns the length of the data in BYTES. The table is like this: create table tb3 ( id int, id2 varchar(100), nome varchar(200) ) | id | id2 | nome | | |---------...
0
votes
2answers
65 views

SQL: Comparing multiple dates

I got a table with multiple columns that contain DateTime namely gendate1 up to gendate8. In my stored procedure, the user will have to input a date (@date_start). Now I have to compare the inputted ...
1
vote
0answers
55 views

How avoid updating unnecessary columns in Update statement? [duplicate]

I have an Update statement which update several columns. Some of those columns are nvarchar(max) type and not always need to be updated. I would like to avoid updating unnecessary columns, so, the ...
-1
votes
1answer
30 views

SQL Job failing due to an error [closed]

I am no expert with SQL for sure but I am wondering if I could take a swing at this on my own. I have an SQL job called "Misc Update NAV" that is scheduled to run every day at 7 am, however, when ...
1
vote
2answers
56 views

Query to see Index Fragmentation on all databases without using SP or temp tables

I am trying to compile a index fragmentation report on all databases, in a multi-server environment. The query will be executed via an openquery command, so I would like to make it as simple as ...
1
vote
2answers
45 views

Inline function Plan Properties in SQL Server 2008

Currently I use the below two queries to get some properties from the execution plan in stored procedures, the problem arises when I try to run it in a SQL Server 2008 version. Do you know if there is ...
6
votes
1answer
96 views

Issue with variable length string between compatibility level 80 and 100

I was getting tons of issues related with a specific scenario on my current enterprise. We have a SQL Server 2008 and we want to move to SQL Server 2016, so we are moving the compatibility from 80 to ...
1
vote
3answers
88 views

Force using an Index in Inner Join SELECT [closed]

I have the following query: select field1, field2 from table1 t1 with (index(IndSearch)) inner join table2 t2 ON t2.Id = t1.Id where t1.date between '04/01/2019' AND '05/01/2019' AND t2.field3 IN(...
4
votes
2answers
235 views

Start job from another SQL server instance

I have a job on an SQL 2008 server (Server A) (I know this is not ideal... That issue is being addressed). The agent runs under NT AUTHORITY\NETWORK SERVICE. I want to add a step that runs a job that ...
1
vote
1answer
40 views

move blob data to new filegroup

short version: what options do i have to move a table that has blob data over to a new filegroup, without blowing out the txlog? details: we have an extremely over-allocated filegroup ("DA1"). the ...
12
votes
2answers
557 views

Can SQL Server create collisions in system generated constraint names?

I have an application which creates millions of tables in a SQL Server 2008 database (non clustered). I am looking to upgrade to SQL Server 2014 (clustered), but am hitting an error message when under ...
-3
votes
1answer
63 views

SQL Performance Issues [closed]

I just recently configured a brand-new Windows SBS 2008 Server with SQL 2008. The box is a HP Proliant DL 380 G5 with 32GB RAM and a 250GB SSD. I have Access97 as a front-end and using ODBC I ...
0
votes
1answer
26 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 ...
0
votes
1answer
15 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
83 views

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

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 ...
6
votes
1answer
584 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 * ...
2
votes
1answer
211 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 ...
3
votes
5answers
431 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 ...
0
votes
1answer
62 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 ...
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 ...
1
vote
0answers
36 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 ...
0
votes
0answers
53 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 ...
0
votes
2answers
65 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 ...
0
votes
2answers
41 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
83 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 ...
-1
votes
1answer
31 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, ...
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
203 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,...
1
vote
2answers
56 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 ...
2
votes
1answer
68 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 ...
1
vote
1answer
44 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
votes
1answer
37 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 (...
0
votes
1answer
170 views

SQL PRINT vs SQL EXEC

When executing the query below, if I use PRINT it prints correctly. I can copy and paste the printed code and execute it. However, if I use EXEC I get the following error: Is there a way of ...
0
votes
2answers
47 views

Can sp_Blitz, sp_BlitzCache, or sp_BlitzFirst identify what queries caused a major growth operation to occur on a particular log file?

I'm currently logging the outputs of sp_Blitz, sp_BlitzCache, and sp_BlitzFirst regularly (via SQL jobs). A particular database's log file grew somewhat exponentially and I believe I can see the ...
3
votes
1answer
226 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 ...
1
vote
1answer
15 views

Remove text from columns that may or may not be present multiple times

I have the following table in SQL Server 2008. create table OrgUnits ( OrgUnitId int not null constraint PK_OrgUnits1 primary key, OrgUnitName varchar(100), OrgUnitLevel int not null, ...
0
votes
2answers
38 views

SQL Server 2017 Express edition Bulk load

I am working on the SQL Server 2017. I need to import 20 text file into one table. Every text file has the same data type and column name. I have checked the data and they have in the same order also. ...
0
votes
1answer
61 views

Using IF clause or while clause in OUTER APPLY

I want to select dates between @startdate and @enddate but I get an error when a month doesn't have 31 days. DECLARE @StartDate date, @EndDate date set @StartDate = '2019-04-01' set @EndDate = '2019-...
0
votes
1answer
133 views

Calculate Average between two dates of different rows

I have the below table BIDID AppID AppStatus Time 23390 16 In Review 2017-07-03 23390 16 Approved 2017-09-03 23390 16 In Review 2017-10-11 23390 16 Approved 2017-12-11 ...
1
vote
1answer
67 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 ...
0
votes
2answers
162 views

Subtracting sum of previous rows

I want to create total field in this table. But in SQL server 2008 can't use 'order by' in OVER clause. I have same PO and difference INV. I want to Qty field minus Quantity field and next row Total ...
0
votes
1answer
23 views

Login mapping only works for the first query in a window

I have a really odd login mapping error for one DB that I can't seem to figure out. When running a simple select statement while impersonating a login (A) on DB(1), it appears to work fine. However ...
2
votes
1answer
94 views

How can I identify non deterministic updates occurring in my SQL Server?

SQL Server books online states Use caution when specifying the FROM clause to provide the criteria for the update operation. The results of an UPDATE statement are undefined if the statement ...
1
vote
1answer
59 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 ...
13
votes
1answer
335 views

SET NOCOUNT Error in handling SQL call after upgrade

We are upgrading our test environment with a new server and updated version of Microsoft SQL Server and have run into an issue. On the new server, our old code will get "operation is not allowed ...