Tag: sql-server-2008-r2

Approach to Data Transfer Methods from Operational data store to Dimensional data source

I use SQL Server 2008 and I work with SSAS. I need to fill my Data Warehouse from my Operational data store(ODS). I create my Facts and ‘Dimensions’ in my ‘Data Warehouse’ and I have some Tables in my ODS what is the best way for transfer data from ODS to DDS with consider that […]

How to combine data from different tables using a query

I have a set of tables that look like what I have shown below. Could you let me know how I can achive the desired output ? CREATE TABLE #ABC([Year] INT, [Month] INT,Customer Varchar(10), SalesofProductA INT); CREATE TABLE #DEF([Year] INT, [Month] INT,Customer Varchar(10), SalesofProductB INT); CREATE TABLE #GHI([Year] INT, [Month] INT,Customer Varchar(10), SalesofProductC INT); INSERT […]

How do you run SQL Server Merge Replication Jobs sequentially?

I work with an environment that uses Merge Replication to publish a dozen publications to 6 a dozen subscribers every 10 minutes. When certain jobs are running simultaneously, deadlocks and blocking is encountered and the replication process is not efficient. I want to create a SQL Server Agent Job that runs a group of Merge […]

Attempted to read or write protected memory-SQL

I am trying to save a view in sql-server management studio which brings the following error message Attempted to read or write protected memory. This is often an indication that other memory is corrupt The same query works fine if I run it separately. The full error message is below =================================== Attempted to read or […]

Calculate a column from a table depending on different column from another tablecomputed column based on different

I have tables: create table Aprovizionari ( ID_Aprovizionare int identity(1,1) primary key, CodCarte char(3) foreign key references Carti(CodCarte), CodLibrarie char(3) foreign key references Librarii(CodLibrarie), DataAprovizionare date default getdate(), Cantitate int default 1 ) create table Returnari ( CodRet char(3) primary key, CodCarte char(3) foreign key references Carti(CodCarte), CodLibrarie char(3) foreign key references Librarii(CodLibrarie), CodEditura char(4) […]

SSMS 2008 R2 – Clear clipboard after copying and pasting result set

Is there a way within SQL Server Management Studio for SQL Server 2008 R2 to clear the clipboard of result set items you’ve copied? I’ve been doing a lot of copy and pasting of large result sets, and each time I copy them it adds to the memory SSMS is taking up, and it ends […]

SQL query to show spending history

I have been asked to create a query that makes a debtors spend history table. Data source: MYOB Exonet There are parent accounts, but the table is to be of child accounts. However, child account transactions don’t actually transact at child level – they do so at parent level. But I want only some of […]

Duplicate index with and without include column

While investigating my database with sp_BlitzIndex script of Brent Ozar. I find some duplicate index issues Multiple Index Personalities: Duplicate keys. Duplicate index issue is for following indexes. CREATE INDEX [IX_Business] ON [dbo].[tblMobile] ( [BusinessID] ); CREATE INDEX [IX_Comb_Marketing] ON [dbo].[tblMobile] ( [BusinessID] ) INCLUDE ( [MobileNo]); The difference between this two index is INCLUDE […]

SQL substring of URL

I am trying to select a part of a url which is after a wildcard expression and before another expression using SQL Server 2008 R2. I have a url like: https%www.msn.com%2ftokenauth%mapserver%ftoken%aogvgkooo%json or: https%www.msn.com%2ftokenauth%mapserver%token=aogvgkooo%json. How do I write a sql query to only show aogvgkooo? The url is stored in column called url. Here is my […]

decrement a column from a table while decrement a column from another table

I have 2 tables Aprovizionari (which means Supplies- of books) and Facturi (which means Invoices). The tables have the following structure: create table Aprovizionari ( ID_Aprovizionare int identity(1,1) primary key, CodCarte char(3) foreign key references Carti(CodCarte), CodLibrarie char(3) foreign key references Librarii(CodLibrarie), DataAprovizionare date default getdate(), Cantitate int default 1 — ^^^^^^^ it should decrement […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.