Sunday, March 25, 2012
Crystal sql caching?
Has anyone seen this before?Shot in the dark. Is save data with report on in report options. Other thought is this report using a command ?
Friday, February 24, 2012
Crosstab Qry with dynamic field names
I am trying to create a stored procedures (SQL 7.0), to provide data
in
a crosstab format.
(I'm using Crystal Reports 8.5, but the Crosstab capabilities are
terrible, so I have to do as much as possible on the SQL side)
I have a table [Occurrences] with the following fields:
Year (int)
Month (int)
Occurs (int)
Claims (int)
I need a query to give me the following format:
Acct_Month 2001 2002 2003
Occurs Claims Occurs Claims Occurs Claims
January 120 180 132 196 110 140
February 154 210 165 202 144 178
March etc..
....
Catch! I need the Year field name to be the contents of the field
Year in the Table (2001, 2002, 2003...). Not the usual Year_1, Year_2
approach.
I got the month name ok...
Acct_Month = DATENAME(month, Convert(Varchar(2), Month) + '/01/'+
Convert(Char(4),Year))
Is it possible to do this easely, without the use of cursors?
Any help would be much appreciated.
Luis PintoLuis (luispinto@.att.net) writes:
> I need a query to give me the following format:
> Acct_Month 2001 2002 2003
> Occurs Claims Occurs Claims Occurs Claims
> January 120 180 132 196 110 140
> February 154 210 165 202 144 178
> March etc..
> ...
> Catch! I need the Year field name to be the contents of the field
> Year in the Table (2001, 2002, 2003...). Not the usual Year_1, Year_2
> approach.
> I got the month name ok...
> Acct_Month = DATENAME(month, Convert(Varchar(2), Month) + '/01/'+
> Convert(Char(4),Year))
> Is it possible to do this easely, without the use of cursors?
It takes a whole of dynamic SQL to get there.
You should probably investigate what RAC can do for you, see
http://www.rac4sql.net/.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
Crosstab qry not upsized
in Access Project to get the same result?
hi John,
"John" <John@.discussions.microsoft.com> ha scritto nel messaggio
news:ABF753FF-80DC-44D9-BDF3-EE8EDA149F11@.microsoft.com...
> My crosstab query did not get upsized using the wizard. What do I need to
do
> in Access Project to get the same result?
SQL Server does not (still) include CROSSTAB query including PIVOT/TRANSFORM
syntax... SQL Server 2005 will include PIVOT/UNPIVOT feature, btu, till it
releases, you have to resort on alternate solution..
SQL Server MVP Itzik Ben Gan released an excellen article about this
(missing) feature, along with a stored procedure to dynamically return
result sets according to specified pivot settings you can read for free at
http://www.winnetmag.com/SQLServer/A...608/15608.html
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||You can also take a look at RAC (http://rac4sql.net). It provides similar
syntax for Access users.
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:2nuarpF4en0iU1@.uni-berlin.de...[vbcol=seagreen]
> hi John,
> "John" <John@.discussions.microsoft.com> ha scritto nel messaggio
> news:ABF753FF-80DC-44D9-BDF3-EE8EDA149F11@.microsoft.com...
to
> do
> SQL Server does not (still) include CROSSTAB query including
PIVOT/TRANSFORM
> syntax... SQL Server 2005 will include PIVOT/UNPIVOT feature, btu, till it
> releases, you have to resort on alternate solution..
> SQL Server MVP Itzik Ben Gan released an excellen article about this
> (missing) feature, along with a stored procedure to dynamically return
> result sets according to specified pivot settings you can read for free at
> http://www.winnetmag.com/SQLServer/A...608/15608.html
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>