Showing posts with label guys. Show all posts
Showing posts with label guys. Show all posts

Friday, March 23, 2012

Please guys i am confused between VS 2003 and RS 2005

Is it possible to use SQL server reporting services 2005 with Visual Studio 2003

I mean when you say new project under VS 2003 does it show under project types:

Business intelligence projects using Reporting services 2005.

Since we have done lot of work using VS 2003(framework 1.1) and now really does not want to get into using Framework 2.0 (VS2005)

But want to use just the reporting services 2005 with VS 2003.

Thank you all very much for the valuable information.

You can create RS 2000 reports with VS 2003 and deploy them to a 2005 Reporting server however you won't be able to use any of the new features of RS 2005.

I would advise you to use the SQL Server Business Intelligence Development Studio to develop RS 2005 reports.

|||

Thank you very much Adam.

How about if i use SQL Server Business Intelligence Development Studio to develop RS 2005 reports to develop reports,

Will i be able to call the reports via URL or may be webreference it via WSDL reportingservices.exe from VS 2003.

We have a requirement to develop almost 75 reports, once we develop those reports using RS 2005, ultimately we have to provide an interface in VS 2003 .aspx page to call those reports. is that possible.

Thank you.

|||

Let me just repharase to make sure I understand you correctly.

You wish develop a set of reports and have them deployed to a reporting services 2005 report server. You then need to develop a front end using VS 2003 and the .NET Framework version 1.1. You want to know whether you can reference a reporting services 2005 web service from your VS 2003 project.

I see no problem with this. You can add a webreference to a web service developed with any version. The WSDL is the definition of the web service and acts like an interface or a contract.

Tuesday, March 20, 2012

Planning of log backup suggestions

Hello Guys,
I would like to overwrite the log file every two weeks.
The log file is backed up every hours every hours (append to the
device) and the full backup runs every day at 11 pm.
I would like to run a job that overwrite the log backup every two
weeks. What do you advice me to do? at which time is better?
I would like to overwrite the file every two weeks at 10 pm before of
the full backup.
any suggestion?
Ina
ina

> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
BACKUP LOG... WITH INIT just after FULL BACKUP of the database
If you do Database20061101.bak as regular full backup , try to compare
GETDATE() -14 with '20061101' portion of .BAK file
Tools
1)CONVERT function
2)SUBSTRING/RIGHT/LEFT functions
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163408898.605077.87490@.m73g2000cwd.googlegro ups.com...
> Hello Guys,
> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
>
> I would like to run a job that overwrite the log backup every two
> weeks. What do you advice me to do? at which time is better?
> I would like to overwrite the file every two weeks at 10 pm before of
> the full backup.
> any suggestion?
> Ina
>
|||Thanks Uri,
I did not understand the this:
If you do Database20061101.bak as regular full backup , try to compare

> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
Ina
Uri Dimant wrote:
[vbcol=seagreen]
> ina
>
> BACKUP LOG... WITH INIT just after FULL BACKUP of the database
> If you do Database20061101.bak as regular full backup , try to compare
> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163408898.605077.87490@.m73g2000cwd.googlegro ups.com...
|||ina
It is how you identify your backup file
DECLARE @.FileName AS VARCHAR(255)
DECLARE @.Date AS VARCHAR(20)
SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
BACKUP DATABASE dbname TO DISK = @.FileName
Now you have to compare , whether the .BAK file is two weeks old and if it
is you just perform BACKUP LOG ...WITH INIT
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163414330.502761.160300@.h48g2000cwc.googlegr oups.com...
> Thanks Uri,
> I did not understand the this:
> If you do Database20061101.bak as regular full backup , try to compare
>
> Ina
>
> Uri Dimant wrote:
>
|||Ah ok thanks did not know So I can do a job that everyday test this
validation and if it true a overwrite the device.
Ina
Uri Dimant wrote:
[vbcol=seagreen]
> ina
> It is how you identify your backup file
> DECLARE @.FileName AS VARCHAR(255)
> DECLARE @.Date AS VARCHAR(20)
> SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
> SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
> BACKUP DATABASE dbname TO DISK = @.FileName
>
> Now you have to compare , whether the .BAK file is two weeks old and if it
> is you just perform BACKUP LOG ...WITH INIT
>
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163414330.502761.160300@.h48g2000cwc.googlegr oups.com...

Planning of log backup suggestions

Hello Guys,
I would like to overwrite the log file every two weeks.
The log file is backed up every hours every hours (append to the
device) and the full backup runs every day at 11 pm.
I would like to run a job that overwrite the log backup every two
weeks. What do you advice me to do? at which time is better?
I would like to overwrite the file every two weeks at 10 pm before of
the full backup.
any suggestion?
Inaina
> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
BACKUP LOG... WITH INIT just after FULL BACKUP of the database
If you do Database20061101.bak as regular full backup , try to compare
GETDATE() -14 with '20061101' portion of .BAK file
Tools
1)CONVERT function
2)SUBSTRING/RIGHT/LEFT functions
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...
> Hello Guys,
> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
>
> I would like to run a job that overwrite the log backup every two
> weeks. What do you advice me to do? at which time is better?
> I would like to overwrite the file every two weeks at 10 pm before of
> the full backup.
> any suggestion?
> Ina
>|||Thanks Uri,
I did not understand the this:
If you do Database20061101.bak as regular full backup , try to compare
> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
Ina
Uri Dimant wrote:
> ina
> > I would like to overwrite the log file every two weeks.
> >
> > The log file is backed up every hours every hours (append to the
> > device) and the full backup runs every day at 11 pm.
>
> BACKUP LOG... WITH INIT just after FULL BACKUP of the database
> If you do Database20061101.bak as regular full backup , try to compare
> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...
> > Hello Guys,
> >
> > I would like to overwrite the log file every two weeks.
> >
> > The log file is backed up every hours every hours (append to the
> > device) and the full backup runs every day at 11 pm.
> >
> >
> > I would like to run a job that overwrite the log backup every two
> > weeks. What do you advice me to do? at which time is better?
> >
> > I would like to overwrite the file every two weeks at 10 pm before of
> > the full backup.
> >
> > any suggestion?
> >
> > Ina
> >|||ina
It is how you identify your backup file
DECLARE @.FileName AS VARCHAR(255)
DECLARE @.Date AS VARCHAR(20)
SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
BACKUP DATABASE dbname TO DISK = @.FileName
Now you have to compare , whether the .BAK file is two weeks old and if it
is you just perform BACKUP LOG ...WITH INIT
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163414330.502761.160300@.h48g2000cwc.googlegroups.com...
> Thanks Uri,
> I did not understand the this:
> If you do Database20061101.bak as regular full backup , try to compare
>> GETDATE() -14 with '20061101' portion of .BAK file
>> Tools
>> 1)CONVERT function
>> 2)SUBSTRING/RIGHT/LEFT functions
> Ina
>
> Uri Dimant wrote:
>> ina
>> > I would like to overwrite the log file every two weeks.
>> >
>> > The log file is backed up every hours every hours (append to the
>> > device) and the full backup runs every day at 11 pm.
>>
>> BACKUP LOG... WITH INIT just after FULL BACKUP of the database
>> If you do Database20061101.bak as regular full backup , try to compare
>> GETDATE() -14 with '20061101' portion of .BAK file
>> Tools
>> 1)CONVERT function
>> 2)SUBSTRING/RIGHT/LEFT functions
>>
>>
>>
>> "ina" <roberta.inalbon@.gmail.com> wrote in message
>> news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...
>> > Hello Guys,
>> >
>> > I would like to overwrite the log file every two weeks.
>> >
>> > The log file is backed up every hours every hours (append to the
>> > device) and the full backup runs every day at 11 pm.
>> >
>> >
>> > I would like to run a job that overwrite the log backup every two
>> > weeks. What do you advice me to do? at which time is better?
>> >
>> > I would like to overwrite the file every two weeks at 10 pm before of
>> > the full backup.
>> >
>> > any suggestion?
>> >
>> > Ina
>> >
>|||Ah ok thanks did not know So I can do a job that everyday test this
validation and if it true a overwrite the device.
Ina
Uri Dimant wrote:
> ina
> It is how you identify your backup file
> DECLARE @.FileName AS VARCHAR(255)
> DECLARE @.Date AS VARCHAR(20)
> SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
> SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
> BACKUP DATABASE dbname TO DISK = @.FileName
>
> Now you have to compare , whether the .BAK file is two weeks old and if it
> is you just perform BACKUP LOG ...WITH INIT
>
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163414330.502761.160300@.h48g2000cwc.googlegroups.com...
> > Thanks Uri,
> >
> > I did not understand the this:
> >
> > If you do Database20061101.bak as regular full backup , try to compare
> >
> >> GETDATE() -14 with '20061101' portion of .BAK file
> >>
> >> Tools
> >>
> >> 1)CONVERT function
> >> 2)SUBSTRING/RIGHT/LEFT functions
> >
> > Ina
> >
> >
> > Uri Dimant wrote:
> >
> >> ina
> >>
> >> > I would like to overwrite the log file every two weeks.
> >> >
> >> > The log file is backed up every hours every hours (append to the
> >> > device) and the full backup runs every day at 11 pm.
> >>
> >>
> >> BACKUP LOG... WITH INIT just after FULL BACKUP of the database
> >>
> >> If you do Database20061101.bak as regular full backup , try to compare
> >> GETDATE() -14 with '20061101' portion of .BAK file
> >>
> >> Tools
> >>
> >> 1)CONVERT function
> >> 2)SUBSTRING/RIGHT/LEFT functions
> >>
> >>
> >>
> >>
> >>
> >>
> >> "ina" <roberta.inalbon@.gmail.com> wrote in message
> >> news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...
> >> > Hello Guys,
> >> >
> >> > I would like to overwrite the log file every two weeks.
> >> >
> >> > The log file is backed up every hours every hours (append to the
> >> > device) and the full backup runs every day at 11 pm.
> >> >
> >> >
> >> > I would like to run a job that overwrite the log backup every two
> >> > weeks. What do you advice me to do? at which time is better?
> >> >
> >> > I would like to overwrite the file every two weeks at 10 pm before of
> >> > the full backup.
> >> >
> >> > any suggestion?
> >> >
> >> > Ina
> >> >
> >

Planning of log backup suggestions

Hello Guys,
I would like to overwrite the log file every two weeks.
The log file is backed up every hours every hours (append to the
device) and the full backup runs every day at 11 pm.
I would like to run a job that overwrite the log backup every two
weeks. What do you advice me to do? at which time is better?
I would like to overwrite the file every two weeks at 10 pm before of
the full backup.
any suggestion?
Inaina

> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
BACKUP LOG... WITH INIT just after FULL BACKUP of the database
If you do Database20061101.bak as regular full backup , try to compare
GETDATE() -14 with '20061101' portion of .BAK file
Tools
1)CONVERT function
2)SUBSTRING/RIGHT/LEFT functions
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...
> Hello Guys,
> I would like to overwrite the log file every two weeks.
> The log file is backed up every hours every hours (append to the
> device) and the full backup runs every day at 11 pm.
>
> I would like to run a job that overwrite the log backup every two
> weeks. What do you advice me to do? at which time is better?
> I would like to overwrite the file every two weeks at 10 pm before of
> the full backup.
> any suggestion?
> Ina
>|||Thanks Uri,
I did not understand the this:
If you do Database20061101.bak as regular full backup , try to compare

> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
Ina
Uri Dimant wrote:
[vbcol=seagreen]
> ina
>
>
> BACKUP LOG... WITH INIT just after FULL BACKUP of the database
> If you do Database20061101.bak as regular full backup , try to compare
> GETDATE() -14 with '20061101' portion of .BAK file
> Tools
> 1)CONVERT function
> 2)SUBSTRING/RIGHT/LEFT functions
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163408898.605077.87490@.m73g2000cwd.googlegroups.com...|||ina
It is how you identify your backup file
DECLARE @.FileName AS VARCHAR(255)
DECLARE @.Date AS VARCHAR(20)
SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
BACKUP DATABASE dbname TO DISK = @.FileName
Now you have to compare , whether the .BAK file is two weeks old and if it
is you just perform BACKUP LOG ...WITH INIT
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1163414330.502761.160300@.h48g2000cwc.googlegroups.com...
> Thanks Uri,
> I did not understand the this:
> If you do Database20061101.bak as regular full backup , try to compare
>
> Ina
>
> Uri Dimant wrote:
>
>|||Ah ok thanks did not know So I can do a job that everyday test this
validation and if it true a overwrite the device.
Ina
Uri Dimant wrote:
[vbcol=seagreen]
> ina
> It is how you identify your backup file
> DECLARE @.FileName AS VARCHAR(255)
> DECLARE @.Date AS VARCHAR(20)
> SET @.Date =CONVERT(VARCHAR(10),GETDATE(),112)
> SELECT @.FileName = 'C:\dbname' + @.Date+'.bak'
> BACKUP DATABASE dbname TO DISK = @.FileName
>
> Now you have to compare , whether the .BAK file is two weeks old and if i
t
> is you just perform BACKUP LOG ...WITH INIT
>
>
>
>
> "ina" <roberta.inalbon@.gmail.com> wrote in message
> news:1163414330.502761.160300@.h48g2000cwc.googlegroups.com...

Saturday, February 25, 2012

PIVOT TABLE QUERY

Hey guys, hopefully you can help me with my request... I am pretty new to SQL, so please bear with me..

I have a table on the system as follows

Item | Year | Month | ucivqa01 |AVG PRICE

ABC 2007 1 10 2.00

ABC 2007 2 10 2.10

ABC 2007 3 10 2.05

ABC 2007 4 10 2.30

ABC 2007 5 10 5.00

ABC 2007 6 10 1.95

XYZ 2007 1 10 100

XYZ 2007 2 10 112

XYZ 2007 3 10 111

XYZ 2007 4 10 100

XYZ 2007 5 10 105

XYZ 2007 6 10 104

I am trying to return the data in the following format:

ITEM MNTH1 MNTH2 MNTH3 MNTH4 MNTH5 MNTH 6 AVG1 AVG2 AVG3 AVG4 AVG5 AVG6

ABC 10 10 10 10 10 10 2.00 2.10 2.05 2.30 5.00 1.95

XYZ 10 10 10 10 10 10 100 112 111 100 105 104

This is only a small sample of the data, and i will be using the resulting SQL over a larger number or records. Also, the month and year will change. . I have a requirement to populate this data based on 41 months prior to the current month,

Anyway, i would appricate any help.

thanks

scotty

Here you go...

Code Snippet

Create Table #data (

Item Varchar(100) ,

Year Varchar(100) ,

Month int ,

ucivqa01 int ,

AVGPRICE float

);

Insert Into #data Values('ABC','2007','1','10','2.00');

Insert Into #data Values('ABC','2007','2','10','2.10');

Insert Into #data Values('ABC','2007','3','10','2.05');

Insert Into #data Values('ABC','2007','4','10','2.30');

Insert Into #data Values('ABC','2007','5','10','5.00');

Insert Into #data Values('ABC','2007','6','10','1.95');

Insert Into #data Values('XYZ','2007','1','10','100');

Insert Into #data Values('XYZ','2007','2','10','112');

Insert Into #data Values('XYZ','2007','3','10','111');

Insert Into #data Values('XYZ','2007','4','10','100');

Insert Into #data Values('XYZ','2007','5','10','105');

Insert Into #data Values('XYZ','2007','6','10','104');

Select

Item

,Max(Case When Year=2007 And Month=1 Then ucivqa01 End) Month1

,Max(Case When Year=2007 And Month=2 Then ucivqa01 End) Month2

,Max(Case When Year=2007 And Month=3 Then ucivqa01 End) Month3

,Max(Case When Year=2007 And Month=4 Then ucivqa01 End) Month4

,Max(Case When Year=2007 And Month=5 Then ucivqa01 End) Month5

,Max(Case When Year=2007 And Month=6 Then ucivqa01 End) Month6

,Avg(Case When Year=2007 And Month=1 Then AVGPRICE End) Avg1

,Avg(Case When Year=2007 And Month=2 Then AVGPRICE End) Avg2

,Avg(Case When Year=2007 And Month=3 Then AVGPRICE End) Avg3

,Avg(Case When Year=2007 And Month=4 Then AVGPRICE End) Avg4

,Avg(Case When Year=2007 And Month=5 Then AVGPRICE End) Avg5

,Avg(Case When Year=2007 And Month=6 Then AVGPRICE End) Avg6

From

#data

Group By

Item

|||

Thanks Manivannan, that is a great help.

I also heard from someone else about using the pivot command instead. From that i was able to build the following up:

(column names are different as this is live data)

SELECT*

FROM(SELECT ITEM, CUSTOMER, InvMONTH, QTY, [Unit Price], PrcMonth

FROM mvxreport.dmsexportstage1)

SOURCEQUERY PIVOT(max(QTY)FOR [InvMONTH] IN([INV1], [INV2], [INV3], [INV4], [INV5], [INV6]))

AS PIVOTTABLE PIVOT(

max([Unit Price])FOR [PrcMONTH] IN([PRC1], [PRC2], [PRC3], [PRC4], [PRC5], [PRC6]))AS PIVOTTABLE1

But when i do this, i cannot group by Item, Customer.. I get the results below:

9002-6050 AGCO NULL NULL NULL NULL 7 NULL NULL NULL NULL NULL 6.27 NULL 9002-6050 AIMS NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 9002-6050 AIMS NULL NULL 4 NULL NULL NULL NULL NULL 6.87 NULL NULL NULL 9002-6050 AIMS 6 NULL NULL NULL NULL NULL 6.87 NULL NULL NULL NULL NULL 9002-6050 AWBWA NULL NULL 4 NULL NULL NULL NULL NULL 5.97 NULL NULL NULL 9002-6050 BUNBURY NULL NULL NULL 6 NULL NULL NULL NULL NULL 5.882 NULL NULL 9002-6050 BUNBURY NULL NULL 3 NULL NULL NULL NULL NULL 5.883 NULL NULL NULL 9002-6050 CBCBROAD NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 9002-6050 CBCBROAD NULL NULL 7 NULL NULL NULL NULL NULL 5.731 NULL NULL NULL 9002-6050 CBCBROAD 16 NULL NULL NULL NULL NULL 5.732 NULL NULL NULL NULL NULL

I would like to have one line per item and Customer Combiniation..

Do you have any suggestions on this?

Thanks
Scotty

|||

Yes.. PIVOT is one of the nice operator. But your case it become hard. PIVOT operator is logically perfect if you want to pivot single column.

I tried to convert my previous query using PIVOT.

Create Table #data (

Item Varchar(100) ,

Year Varchar(100) ,

Month int ,

ucivqa01 int ,

AVGPRICE float

);

Insert Into #data Values('ABC','2007','1','10','2.00');

Insert Into #data Values('ABC','2007','2','10','2.10');

Insert Into #data Values('ABC','2007','3','10','2.05');

Insert Into #data Values('ABC','2007','4','10','2.30');

Insert Into #data Values('ABC','2007','5','10','5.00');

Insert Into #data Values('ABC','2007','6','10','1.95');

Insert Into #data Values('XYZ','2007','1','10','100');

Insert Into #data Values('XYZ','2007','2','10','112');

Insert Into #data Values('XYZ','2007','3','10','111');

Insert Into #data Values('XYZ','2007','4','10','100');

Insert Into #data Values('XYZ','2007','5','10','105');

Insert Into #data Values('XYZ','2007','6','10','104');

Code Snippet

Select * From

(

Select * From

(Select Item,Cast(Year as varchar) + '-' + Cast(Month as varchar) YearMonth,ucivqa01 From #data) as Data1

PIVOT

(

Max(ucivqa01) For YearMonth in ([2007-1], [2007-2], [2007-3], [2007-4], [2007-5], [2007-6])

) Pvt1

) as MaxData

Join

(

Select * From

(Select Item,Cast(Year as varchar) + '-' + Cast(Month as varchar) YearMonth,AVGPRICE From #data) as Data2

PIVOT

(

Avg(AVGPRICE) For YearMonth in ([2007-1], [2007-2], [2007-3], [2007-4], [2007-5], [2007-6])

) Pvt2

) as AVGData

on MaxData.Item=AVGData.Item