Questions tagged [sql-server-2008]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Correct way to restore dbs to new server

We are migrating from sql server 2008 to 2017 and will do the following install sql server 2017 on the new machine make backups of all dbs on old server RESTORE DATABASE DbName FROM DISK = 'C:\temp\...
1
vote
0answers
25 views

ODBC connects but authentication fails on users table

We have sql 2008 running in mixed mode. The site where sql is running the ODBC connection works and ms access authenticates against the user table. We have an IPSec vpn to a satellite office using ...
0
votes
2answers
368 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 ...
1
vote
3answers
164 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 ...
-2
votes
1answer
69 views

Send by SQL sales report for each seller [closed]

How can I send a report to each seller about their sales? I can already generate the report, but I cannot send it individually, this is an example of my data this is my script, i hope someone can ...
0
votes
2answers
351 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
2answers
53 views

Sync database table schema and stored procedures

We have 2 databases. One is at our server, the other is local. We need to sync them both in a manner that local database has all data and server database has no data only empty tables and stored ...
0
votes
0answers
11 views

Import mysql tables and data into Sql server2008, when mysql is on a remote server and sql server 2008 is my local server

I am trying to import mysql tables and data (on a remote server), to sql server local database. I have exported data from mysql workbench and saved them as .txt and then imported flat text files into ...
37
votes
2answers
2k views

SQL Server unpredictable select results (dbms error?)

Below is simple example, which returns strange results, that are unpredictable and we cannot explain it in our team. Are we doing something wrong or is it SQL Server error? After some investigation ...
0
votes
1answer
423 views

Crystal Reports - Linked Server Connection

We have SQL server 2012 and we connect another server which is on different domain using a Linked Server name-> 192.xx.xx.xx. I can query and view the 192.xx.xx.xx data using SQL Server. Now ...
19
votes
4answers
37k views

How to clone a user in SQL Server 2008 R2?

Is there a way to clone users' security and permissions in Microsoft SQL Server, preferably using the SQL Server Management Studio GUI?
1
vote
1answer
19 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, ...
1
vote
1answer
65 views

Find all occurrence of value from column b in column a

So basically I have 2 tables which I merge by SELECT t2.columnA , t1.columnB, t1.description FROM Table1 as t1 LEFT JOIN Table2 as t2 on t1.GIDNumber=t2.TwrNumber I need to display all occurrence ...
1
vote
1answer
25 views

Updating values based on 3 table join

I have three tables orders, customer_old and customer_new. The orders table contains the old_user_login and associated order number. The customer_old table contains the information on customer, ...
13
votes
6answers
6k 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
7
votes
1answer
12k views

Concatenate one-to-many field in single result?

Say I have the following query: SELECT * FROM AppDetails, AppTags WHERE AppDetails.AppID = '1' AND AppDetails.AppID = AppTags.AppID Which gives the following results: AppID AppName ...
2
votes
1answer
2k views

SQL Server 2012 Installation Error on Windows 2008 Server

I am facing an error while trying to install SQL Server 2012 EXPRESS ADVANCED EDITION(32bit) on Windows Server 2008 Enterprise(64bit). After passing Rule Check, at install updates section, error ...
32
votes
5answers
114k views

Logical operators OR AND in condition and order of conditions in WHERE

Let's examine these two statements: IF (CONDITION 1) OR (CONDITION 2) ... IF (CONDITION 3) AND (CONDITION 4) ... If CONDITION 1 is TRUE, will CONDITION 2 be checked? If CONDITION 3 is FALSE, will ...
7
votes
1answer
1k views

SSIS OLE DB Source Editor Data Access Mode: “SQL command” vs “Table or view”

In BIDS, I'm running a Data Flow Task & I'm wondering what the difference is behind the scenes between using "Table or view" vs "SQL Command" for the Data Access Mode for an OLE DB Source. For ...
0
votes
2answers
976 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 ...
3
votes
2answers
108 views

Can subqueries produce different execution plans than CTE's?

I was talking with the bossman, and he prefers subqueries over CTE's. Personally, I loathe subqueries. He mentioned that subqueries can be faster, but I am not convinced. I ran this short test: ...
0
votes
2answers
40 views

Memory issue in Transactional Replication

I want to replicate a data of 500 GB through transactional replication once in a day, so my query is this, will it create a new file in the snapshot folder on daily basis of 200-300 GB or will update ...
1
vote
1answer
190 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/...
12
votes
4answers
72k views

How do I run a batch file from a scheduled Job via SQL Server Agent

I'm attempting to run a (Windows) batch file from within a SQL Server agent job under SQL Server 2008 R2. In the Job Steps, I've created a new step, set its type to "Operating system (CmdExec)". I ...
0
votes
1answer
43 views

Passing Variable in json_value in sql server 2016 [duplicate]

declare @id int set @id = 1754 select (JSON_VALUE(cast(ad.data_map as varchar(max)),'$.dataMap."1754".value')) CorrespondanceNumber, (JSON_VALUE(cast(ad.data_map as varchar(max)),'$.dataMap.***"'+...
9
votes
2answers
9k views

How to trace SQL queries which are crashing SQL Server

We have a SQL Server 2008 database server (it happens to be running under MS Failover Clustering, but I don't think that is relevant here). Our application runs Hibernate for DB access, and since we ...
11
votes
1answer
355 views

SQLServer Upgrade Advisor 2014 hanging

I try to run SQL Server Upgrade Advisor 2014 against a SQL Server 2008 server. Everything looks fine when connecting to the 2008 server and I can select which database I would like to analyze. But ...
7
votes
4answers
9k views

In SQL Server 2008, how can I get all the columns that are marked as nullable in their schemas even though no records contain NULL for those columns?

In my legacy database, a lot of the time the schema needlessly allows null entries for particular columns. To help find out which columns in particular, I need to do some querying of SQL Server 2008 ...
18
votes
7answers
2k views

Group daily schedule into [Start date; End date] intervals with the list of week days

I need to convert data between two systems. First system stores schedules as a plain list of dates. Each date that is included in the schedule is one row. There can be various gaps in the sequence ...
18
votes
3answers
6k views

Why might a table's data space take up 4x the size of the raw data?

I have a table with 490 M rows and 55 GB of table space, so about 167 bytes per row. The table has three columns: a VARCHAR(100), a DATETIME2(0), and a SMALLINT. The average length of the text in ...
0
votes
2answers
97 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 ...
14
votes
3answers
10k views

Is it possible to get execution call stack in a trigger?

I have 10 stored procedures and each of them does INSERTs into one tableX. Is it possible in a trigger body of tableX to get what object causes modification of tableX (stored proc1 or sp2 or....) ? ...
0
votes
2answers
113 views

Accessing Registered Servers over Excel

With DBs in different countries, different servers but same structure, I have created registered server to access them when running certain queries for reports on SSMS. Thus far this is ok. However, I ...
4
votes
1answer
638 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 ...
28
votes
2answers
11k views

If positive, sum all items. If negative, return each one

I am needing to find a way to SUM() all of the positive values for num and return the SUM() of all positive numbers and an individual row for each negative number. Below is a sample DDL: Create ...
13
votes
5answers
24k views

Pros/Cons Using multiple databases vs using single database

I was working on a new project which has the requirement to use 7 databases. Arguing performance, stability, optimization is easier implemented. While I don't agree, I'm having trouble collecting ...
1
vote
1answer
132 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 ...
0
votes
1answer
104 views

Find time between status changes for each unit on each incident

I have a table called History that holds unit status changes when they are assigned to incidents. Each unit can change status from DP to AK to ER to AR. Statuses can be skipped. The table is called ...
0
votes
0answers
20 views

Insert Into Table From SQL Server To MySQL

I am on server1 which has a linked server to server2 and server3. This must be done on server1, but I can not get the syntax accurate. What I want to do is query server2 using OPENQUERY, and ...
1
vote
1answer
152 views

Correcting and Detecting overlapped dates with CTE

I have a CTE that marks (as bits) overlapped records based on certain criteria. After filtering, I need to update these records to "correct" them and make them sequential, but I'm getting a 4104 on ...
15
votes
5answers
5k views

How to add 1 milliseconds to a datetime string?

Based on a select, I can return x rows like this: 1 2019-07-23 10:14:04.000 1 2019-07-23 10:14:11.000 2 2019-07-23 10:45:32.000 1 2019-07-23 10:45:33.000 We have all milliseconds with 0. Is ...
14
votes
7answers
156k views

How can I take backup of particular tables in SQL Server 2008 using T-SQL Script

I want to take a backup of particular tables available in my database in a .bak file, and all these should be done using a T-SQL script.
0
votes
2answers
45 views

How To Grant A User Just To Create A Table In Existing Database But Not To See Other Existing Tables In It

We have dealed with an outsource company to install an application for use of our accounting department. Now, they want to access our existing database to install their application but i don't want ...
0
votes
2answers
354 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,...
-3
votes
1answer
98 views

The login is from an untrusted domain and cannot be used with Windows authentication

I am facing this issue after trying to run a Windows application on sharing client side in a workgroup environment, while this application working on server machine fine.
1
vote
1answer
240 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
512 views

Validate data between two large tables

I have this scenario. Data files are transferred from multiple stores (transactions) to the head office as they happen. For each store the table in question is pretty big in size. At the head office, ...
1
vote
3answers
2k views

Can't create indexes on really large table!

I have a table with over 300 Million rows in it. When I try to create an index on the table I get the error message below. Msg 1105, Level 17, State 2, Line 3 Could not allocate space for object ...
2
votes
1answer
106 views

Replace/upgrade mirrored server hardware

We are deploying new VMs for a mirrored database that is in high safety mode with automatic failover and also going from SQL Server 2008 to SQL Server 2008R2. Most of the documentation I've come ...
0
votes
1answer
78 views

Mssql query problem. Column '' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

There is a problem I have experienced in mssql. ( but I don't have this problem in mysql. ) They know two different engines. but I could not find a solution. Do you think I can fix this error? My ...