Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Tuesday, March 27, 2012

Getting the format bar while using SSRS Web Service

Hi,

I am using the URL method to call reports where you get all the look and feel and report format and export options on the report page itself. When I tried to use the Web Service I couldn't find those options. I can render the reports only one format at a time. Is there anyway to view the reports as in URL methos using web service with all the formatting options? Thank You.

Regards,

Das.

The report toolbar is available only with URL addressability. If you need to use the Web Service, why don't use the Report Viewer controls? Behind the scenes, they call down to the Web service APIs.

Getting the "[dbName].[schema].[tblName]" format of a table

Hi all,

Under SQL Server 2005 :

Is there a command that can get me the "dbName.schema.tblName" for a table?

Or a function that does something that look like that.

Dale

Hi Dale,

See INFORMATION_SCHEMA.TABLES view in BOL.

select

quotename(TABLE_CATALOG) + '.' + quotename(TABLE_SCHEMA) + '.' + quotename(TABLE_NAME)

from

INFORMATION_SCHEMA.TABLES

where

TABLE_CATALOG = 'Northwind'

and TABLE_SCHEMA = 'dbo'

and TABLE_NAME = 'Orders'

and TABLE_TYPE = 'BASE TABLE'

AMB

|||

Is getting the list of table from the INFORMATION_SCHEMA.Tables is a bad programming habit?

I would get the list of table from there since its more complete than the list from sys.tables.

|||

Hi Dale,

I do not think so. There are developers / dba that prefer object catalog views, other prefer information_schema views, etc. Another approach could be:

use northwind

go

select

db_name(),

object_name([object_id]),

schema_name([schema_id])

from

northwind.sys.objects

where

[type] ='U'

and is_ms_shipped = 0

go

AMB

|||I agree with Dale J. As per the MSDN the "INFORMATION_SCHEMA.TABLES" view retruns each table in the current database for which the current user has permissions. But Sys.Tables will return all the table.|||

Hi Manivannan.D.Sekaran,

Seeing just what you are allow to, is called security and not bad practice.

AMB

|||

Yes AMB,

I just agreed the point of DaleJ "getting more data than this view". I didn't say it is a bad practice. (i wont say IDS are bad-practice).

I want to share one point here, the information shcema is the fixed format on the SQL-92 Standard. Whenever the SQL Server's system tables change this views structure never change.(some times it breaks the backward compatibility).

Since it is a SQL-92 standard these quires can be executed on any database (supported by Informix, Oracle, Sybase & our own SQL Server)

sql

getting tables size

This is a multi-part message in MIME format.
--=_NextPart_000_0401_01C51E40.7BE320B0
Content-Type: text/plain;
charset="windows-1255"
Content-Transfer-Encoding: quoted-printable
Hi,
is there a method of getting table current size?
TIA!!
--=_NextPart_000_0401_01C51E40.7BE320B0
Content-Type: text/html;
charset="windows-1255"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
Hi,

is there a method of getting table = current size?

TIA!!



--=_NextPart_000_0401_01C51E40.7BE320B0--Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:
> Hi,
> is there a method of getting table current size?
> TIA!!
>
>|||This is a multi-part message in MIME format.
--=_NextPart_000_0419_01C51E49.1F69CB00
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
thanks!
is there a sample of using it in a loop for getting all tables =information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message =news:A7ABFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:
> Hi, > > is there a method of getting table current size?
> > TIA!!
> > >
--=_NextPart_000_0419_01C51E49.1F69CB00
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

thanks!
is there a sample of using it in a loop =for getting all tables information?
"John Bell" wrote in message news:A7A=BFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...HiHav=e you looked at sp_spaceused ?John"z. f." =wrote:> Hi, > > is there a method of getting table current =size?> > TIA!!> > >

--=_NextPart_000_0419_01C51E49.1F69CB00--|||You could use Nigel's script:
http://www.nigelrivett.net/SQLAdmin/SpaceUsedAllTables.htm
l
Rgds,
Paul Ibison (SQL Server MVP)|||select object_name(id) as 'Table', used from sysindexes
Madhivanan|||This is a multi-part message in MIME format.
--=_NextPart_000_0066_01C51E6F.E2788700
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
sp_MSForEachtable 'sp_spaceused ''?'''
-- Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message =news:OEDE0hjHFHA.2976@.TK2MSFTNGP15.phx.gbl...
thanks!
is there a sample of using it in a loop for getting all tables =information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message =news:A7ABFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:
> Hi, > > is there a method of getting table current size?
> > TIA!!
> > >
--=_NextPart_000_0066_01C51E6F.E2788700
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

sp_MSForEachtable 'sp_spaceused ''?'''
-- Roji. P. ThomasNet Asset Managementhttps://www.netassetmanagemen=t.com
"z. f." wrote in message news:OEDE0hjHFHA.2976=@.TK2MSFTNGP15.phx.gbl...
thanks!

is there a sample of using it in a =loop for getting all tables information?


"John Bell" wrote in message news:A7A=BFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...HiHav=e you looked at sp_spaceused ?John"z. f." =wrote:> Hi, > > is there a method of getting table current size?> > TIA!!> > >

--=_NextPart_000_0066_01C51E6F.E2788700--|||This is a multi-part message in MIME format.
--=_NextPart_000_003C_01C51E55.AFC03570
Content-Type: text/plain;
charset="windows-1255"
Content-Transfer-Encoding: quoted-printable
Try my stored procedure, that lists the sizes of all tables or top n =tables:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
-- HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message =news:u8JdQ$iHFHA.3332@.TK2MSFTNGP15.phx.gbl...
Hi,
is there a method of getting table current size?
TIA!!
--=_NextPart_000_003C_01C51E55.AFC03570
Content-Type: text/html;
charset="windows-1255"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Try my stored procedure, that lists the sizes of all =tables or top n tables:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm">http://vyask=n.tripod.com/sp_show_biggest_tables.htm-- HTH,Vyas, MVP (SQL Server)SQL Server Articles and Code =Samples @. http://vyaskn.tripod.com/">http://vyaskn.tripod.com/
"z. f." wrote in message news:u8JdQ$iHFHA.3332=@.TK2MSFTNGP15.phx.gbl...
Hi,

is there a method of getting table =current size?

TIA!!




--=_NextPart_000_003C_01C51E55.AFC03570--

Friday, February 24, 2012

Getting first and last alike records

I am retrieving data from a table and have it in the format as follows:

SlabNum MoldWidth Section
-------------
1 4.5 100
1 4.3 101
1 4.2 102
1 4.1 103
2 2.1 104
2 2.5 105
2 2.7 106
2 3.0 107
3 1.1 108
3 1.1 109

What I would like to end up with is a table with each row containing just the slab number and the first and last widths. Example:

SlabNumber BeginningWidth EndingWidth
----------------
1 4.5 4.1
2 2.1 3.0
3 1.1 1.1

Any suggestions on ways to do this?most likely you want to use a max and a min with a group by.

as for the details I am not sure. Is the begining width the one with lowest section number?|||I thought about MIN and MAX but the first and last aren't always the min and max values... I need the actual first record of a slab and the last record of a slab.

Randy|||I thought about MIN and MAX but the first and last aren't always the min and max values... I need the actual first record of a slab and the last record of a slab.

Randy

and how do you define first and last?|||Ok, just talked to co-worker about this... I only need the FIRST value of each slab... not the last. Like:

SlabNumber BeginningWidth ---------------
1 4.5
2 2.1
3 1.1

Is there an easy way to do this? The records are in order by a field called creation_time. So I'm thinking I can do something with MIN(Creation_Time) to get the first one of each group.

Randy|||that is correct|||select P.productid, P.SlabNumber, S.topmoldwidth, S.CreationTime
from product P
join section S on P.ProductId = S.ProductId
where P.CreationTime > '10/11/2007' and P.SlabNumber is not null
and P.SlabNumber <> 'Crop'
order by P.ProductId, S.CreationTime

How do I change the above to only choose the smallest time from each SlabNum. I put MIN() around creation time and it makes me add all the other fiields to the group clause and i still get more than one line for each slab. I don't do a lot of groupings in SQL... most of my query's are pretty simple.

Randy|||sorry, accidently double posted last message|||DECLARE @.Sample TABLE (SlabNum INT, MoldWidth DECIMAL(3, 1), Section INT)

INSERT @.Sample
SELECT 1, 4.5, 100 UNION ALL
SELECT 1, 4.3, 101 UNION ALL
SELECT 1, 4.2, 102 UNION ALL
SELECT 1, 4.1, 103 UNION ALL
SELECT 2, 2.1, 104 UNION ALL
SELECT 2, 2.5, 105 UNION ALL
SELECT 2, 2.7, 106 UNION ALL
SELECT 2, 3.0, 107 UNION ALL
SELECT 3, 1.1, 108 UNION ALL
SELECT 3, 1.1, 109

-- SQL Server 2000
SELECT DISTINCT s1.SlabNum,
(SELECT TOP 1 s2.MoldWidth FROM @.Sample AS s2 WHERE s2.SlabNum = s1.SlabNum ORDER BY s2.Section) AS MoldWidth
FROM @.Sample AS s1
ORDER BY s1.SlabNum

-- SQL Server 2005
SELECT SlabNum,
MoldWidth
FROM (
SELECT SlabNum,
MoldWidth,
ROW_NUMBER() OVER (PARTITION BY SlabNum ORDER BY Section) AS RecID
FROM @.Sample
) AS d
WHERE RecID = 1
ORDER BY SlabNum