Recently Indexed Messages:-



SQL Server 2008 :: View Creation Using XML Column On Linked / Distributed Server?

Sep 4, 2015

A recent SharePoint upgrade has rendered several views obsolete. I am redefining them so that our upper level executive reports show valid data.(yes, I know that doing anything to sharepoint could cause MS to deny support, having said that, this is something I've inherited and need to fix, pronto) The old view was created like so:

USE [AHMC]
GO
/****** Object: View [dbo].[vwSurgicalVolumes] Script Date: 09/04/2015 09:28:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[vwSurgicalVolumes] AS
SELECT

[code]....

As I said, this view is used in a report showing surgical minutes.SharePoint is now on a new server, which is linked differently (distributed?) I've used OPENQUERY to get my 'new' query to work;

SELECT *
FROM OPENQUERY ([PORTALWEBDB], 'SELECT
--AllLists
AL.tp_ID AS ALtpID
,AL.tp_WebID as altpwebid
,AL.tp_Title AS ALTitle

[code]....

My data (ie surgical minutes, etc) seems to be in the XML column, AUD.tp_ColumnSet . So I need to parse it out and convert it to INT to maintain consistency with the previous view. How do I do this within the context of the view definition?Here is a representation of the new and old view data copied to excel :

<datetime1>2014-08-14T04:00:00</datetime1><float1>2.000000000000000e+000</float1><float2>4.190000000000000e+002</float2><float3>1.600000000000000e+001</float3><float4>8.110000000000000e+002</float4><sql_variant1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes"

[Code] ....

can't format it to make it look decent. InHouseCases =2, InHouseMinutes=419, OutPatientCases =16, OutPatientMinutes=1230. This corresponds to the new data I can see in the XML column; 2.000000000000000e+000 is indeed 2 and 4.190000000000000e_002 is indeed 419.

View 4 Replies

T-SQL (SS2K8) :: How To Find All Empty Files In A Database

May 4, 2015

I need to find all empty files in the database (SQL Server 2008R2 SP2) The files become empty after the archival of a partitioned tables.

I was trying this:

select f.name, *
from sysfiles f (nolock)
left join sys.filegroups fg (nolock)
on f.name = fg.name
left join sys.indexes i (nolock)
on i.data_space_id = fg.data_space_id
left join sys.all_objects o (nolock)
ON i.[object_id] = o.[object_id]
where i.name is NULL and o.name is NULL

Did not work.

My file names are the same as the filgroup names containing the file, this is why I was joining by name.

View 2 Replies

Integration Services :: SSIS - Values Are Not Getting Rounded Off

Sep 17, 2015

I came across the below scenario in SSIS where the values are not getting rounded off in SSIS as expected.

I am passing the value 23007.945 and using a derived column expression to round off the value Round(number,2).

Placed a dataviewer to view the outcome after the derived column expression.Value after derived column expression seems to be 23007.94 but the same when passed in SQL select round(23007.945,2) gives us the value as 23007.95.

What could be causing this?

View 4 Replies

Transact SQL :: Transpose (Pivot) Columns To Rows?

Aug 15, 2015

I need to pivot my records in columns into rows. Here is sample data:

create table #columnstorows
(
Payer varchar (5),                  
ID varchar (5),      
ClM varchar (2),                 
Paid1 float,
Paid2 float,
Paid3 float
)                      

[code]....

Desired result:

Payer1 Payer2
ID1 ID2
Paid1A Paid1B
Paid2A Paid2B
Paid3A Paid3B
U001 U002
 001 002
76.58 19.53
 153.48 96.43
 53.48   200

View 10 Replies

Import CSV To Server From Command Line

Mar 26, 2015

I want to import a huge .csv file in my sql server database.

There are about 10000 rows and 30 columns

My file looks like this:
Attributname1; Attributname2; Attributname3; ...
data; data; data;...
data; data; data;...
data; data; data;...

Now my idea is to do this on the command line/batch script. I have found different ways to do this job but the problem is i have to create a table in the database first. The entries in the first line of the csv file are the attribute names.

After creating the table with attributes i must write the data in the database.

View 1 Replies

Power Pivot :: Creating A Burn Down Chart Using Running Total Of Cumulative Hours

Jul 21, 2015

Creating a burn down chart using a running total of cumulative hours with the following formula:

CumulativeHoursLeft:=CALCULATE (
    SUM('Projects'[Budget hours]) - SUM ( 'hours'[Hours] ),
    FILTER (
        ALL ( 'hours'[Date] ),
        'hours'[Date] <= MAX ('hours'[Date])
    )
)

Works great except that in a Line Chart using [Date] as the Axis and CumulativeHoursLeft as the value, I get these spikes on days for which the employee reported no hours. I do know what exactly the measure is doing in this instance and I do not get this in a table, those dates simply do not appear. I have tried both Categories and Continuous for the Line Chart. I have also tried filtering where [Date] is not blank.how to get rid of the spikes?

View 5 Replies

Query To Show Total By Shop On Time Range

Aug 28, 2014

How to edit this query to show the total by shop on time range ?

current result.(Time range from 9:00am-23:00pm)
Shop Time_slot cur Amt, yest Amt, Diff Amt, Sales Direction
Abc 10:59 $100 $50 +50 (+)
Abc 11:59 $100 $50 +150 (+)
Abc 12:59 $100 $50 +50 (+)
BBB 11:59 $100 $50 +150 (+)
BBB 12:59 $100 $50 +50 (+)
------------------------------------------------------------------

Desired Result .
Shop Time_slot cur Amt, yest Amt, Diff Amt, Sales Direction
Abc 10:59 $100 $50 +50 (+)
Abc 11:59 $100 $50 +150 (+)
Abc 12:59 $100 $50 +50 (+)
Total $300 $150 +$200 (+)

BBB 11:59 $10 $50 -40 (-)
BBB 12:59 $10 $50 -40 (-)
Total $20 $100 -80 (-)
-----------------------------------------------------------

select shop
,ltrim(str(datepart(hh,yourdatetimefield)))+':00 - '+ltrim(str(datepart(hh,yourdatetimefield)))+':59' as time_span
,sum(case
when datediff(dd,yourdatetimefield,getdate())=0

[Code] .....

View 1 Replies

Locking Column (cannot Drop Columns In The Table)

May 27, 2015

How can I pervert dropping the column in the table (probably some process doing that and I want to find it) ? I need to be able to modify but not alter / drop column .

View 4 Replies

DB Engine :: Alert When Database Table Is Created

Jul 24, 2015

I use below trigger to email me when a database is created or dropped.
  
CREATE  TRIGGER [DDL_CREATE_DATABASE_EVENT]
ON ALL SERVER
FOR CREATE_DATABASE
AS
DECLARE @bd VARCHAR(MAX)
DECLARE @tsql VARCHAR(MAX)
SET @tsql = EVENTDATA().value

[Code] ...

Is there a way we can get notification when a table is created or altered or dropped ?

View 3 Replies

Creating Package Upsert / Update And Insert Operations From Database?

Mar 18, 2014

how to create package upsert industry and want to do update and insert operations from database.

View 4 Replies

Transact SQL :: Field Not Update Correctly - Adding Extra Duplicated Row

Oct 8, 2015

I have the following querry :

SELECT APHIST.ReturnDate AS ATDATE
,API_HIST.[ActionPlanItemID]
,API_HIST.[ActionPlanID]
,PIT.[ProductItemID]

[Code] ....

It produced the following result

Based on my querry when n=2, it should be set to 0, why it cannot be set ?

if I added the value 2 to the list of values as below :

CROSS APPLY (Values(0),(1),(2)) d(n)

Then the value  n=2 is updated but it adds  extra duplicated rows which is not part of my real

View 11 Replies

Transact SQL :: MERGE Function And OUTPUT To A File

Sep 14, 2015

I used the MERGE function for the first time. Now I have to create a pipe-delimited delta file for a 3rd party client of any deltas that may exist in our database.

What is the best way to do this? I have OUTPUT to a result set of the deltas...but I have to send over the entire table to the 3rd party via a pipe-delimited file.

View 5 Replies

Reporting Services :: SSRS Date Expressions

Sep 21, 2015

SSRS expressions for the following queries.

Last year last Week (15/9/2014)
Last Week ( 14/9/2015)
Before Last Week (7/9/2015)

View 2 Replies

Reporting Services :: Alternative Check Box Column Background Color Changes

Sep 8, 2015

I am working on SSRS 2008, I need to change background color of alternative columns. We can change simply if it is a textbox column but my columns all are in checkbox () based one expressions and I didn't see any background color option In properties for this check box column(please see the images below), is there any way to change background color  for alternative columns?I need like this

View 3 Replies

Integration Services :: Logon Failure - Unknown User Name Or Bad Password - SSIS Error

Sep 8, 2015

I'm trying to execute a SSIS package via proxy user but I keep getting the following error message regardless of I have tried to do to fix it, I have done the following so far:-

1. Recreated the proxy user
2. Retyped the password, under credentials

Message : Unable to start execution of step 1 (reason: Error authenticating proxy "proxyname", system error: Logon failure: unknown user name or bad password.).  The step failed.

View 3 Replies



Copyrights 2005-15 www.BigResource.com, All rights reserved