Hi,
I am wondering if any of the DB Gurus out there help me finding a way to export mssql SCHEMA (not the actual data) into any standard language, like DDL, XML. At this point converting to XML would be the ideal but I am open to DDL format also.
I would love to hear any feedback about "If this is even possible
or not ?".
thanks,
tinkiSchema can be in a SQL script form. So, ideally this tool that
I am looking for will convery this SQL script info to DDL or
XML.
Thanks in advance,
Tinki|||Have you tried Enterprise Manager?|||DDL, or Data Definition Language, is RDBMS-specific, meaning that it is not like COBOL, VBScript, or XML. DDL for Oracle will look differently than DDL for Sybase for the same set of tables, while certain objects in Oracle will not even be found in Sybase. XML on the other hand is a standard.
Try DBArtisan from Embarcadero. Even though it only has an option "Extract Data as XML", it also allows you to generate the schema portion of your data.|||mySQL and SQL Server have very similar DDLs|||I'm glad|||Originally posted by Paul Young
Have you tried Enterprise Manager?
yes, I have tried Enterprise manager. It lets me export data to SQL script (which is very database specific). what I am looking at something
which can convert this SQL script to something more wodely accepted as a general standard so that my rest of the code does not get too
much database dependent.
tinki|||Originally posted by rdjabarov
DDL, or Data Definition Language, is RDBMS-specific, meaning that it is not like COBOL, VBScript, or XML. DDL for Oracle will look differently than DDL for Sybase for the same set of tables, while certain objects in Oracle will not even be found in Sybase. XML on the other hand is a standard.
Try DBArtisan from Embarcadero. Even though it only has an option "Extract Data as XML", it also allows you to generate the schema portion of your data.
thanks rdjabarov, I will try DBArtisan.
I have tried XMLSPY but it couldn't get to export schema. It was exporting only the data.
tinki.|||Originally posted by rdjabarov
I'm glad
I'm glad your glad!
Should have read tinki's post a little closer, thought he wanted a MSSQL to MYSQL convertion.|||DBArtisan is somewhat pricy, but a must-have tool. Also does lots of other things.|||Originally posted by tinki
what I am looking at something which can convert this SQL script to something more wodely accepted as a general standard so that my rest of the code does not get too much database dependent.
tinki
Are you actually looking for a db-independent db structure, rather than exporting your current db structure? Then, you should take these recommendations into account:
1) use short (table & field) identifiers (Informix 7, for instance, has a maximum length of 18, and Oracle 40)
2) use just characters, digits and the underscore for your identifiers
3) use just ANSI SQL data types, and not, for example, BOOLEAN (BIT)
...
I'm sure that the real gurus in this forum can easely enhance this list.
However, using a data model with no db-specific properties makes it easy to build a db-independent application, with or without a middleware encapsulating db-specific properties.
Showing posts with label converting. Show all posts
Showing posts with label converting. Show all posts
Wednesday, March 7, 2012
Friday, February 24, 2012
Calculations in the SQL Server
Hi All,
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
Schapopa
Deeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegr oups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>
|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegro ups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
Schapopa
Deeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegr oups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>
|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegro ups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
Labels:
access,
calculations,
converting,
database,
microsoft,
mysql,
oracle,
server,
sql,
written
Calculations in the SQL Server
Hi All,
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
SchapopaDeeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a
> single view with all of the calcs you need...
> > Hi All,
> >
> > I am converting database from Access 2000 to SQL Server 2000.
> > I have very long calculations written in Access.
> > eg.
> > A+B as C, C+D as E, E + F as G and so on...
> >
> > In SQL I created views, and they refer to each other. From my query
> > with calculation I created 5 views, where view 2 use calculations
from
> > view 1, view 3 from view 2 and 1... and view 5 use view 1 to view
4. I
> > use those views in Stored Procedures with sum, average and LAST
which
> > doesn't exist in SQL. (So that is another view)
> >
> > All of that works but very slow.
> >
> > Is there any better way to handle this kind of calulations?|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegroups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a
> single view with all of the calcs you need...
> > Hi All,
> >
> > I am converting database from Access 2000 to SQL Server 2000.
> > I have very long calculations written in Access.
> > eg.
> > A+B as C, C+D as E, E + F as G and so on...
> >
> > In SQL I created views, and they refer to each other. From my query
> > with calculation I created 5 views, where view 2 use calculations
from
> > view 1, view 3 from view 2 and 1... and view 5 use view 1 to view
4. I
> > use those views in Stored Procedures with sum, average and LAST
which
> > doesn't exist in SQL. (So that is another view)
> >
> > All of that works but very slow.
> >
> > Is there any better way to handle this kind of calulations?
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
SchapopaDeeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a
> single view with all of the calcs you need...
> > Hi All,
> >
> > I am converting database from Access 2000 to SQL Server 2000.
> > I have very long calculations written in Access.
> > eg.
> > A+B as C, C+D as E, E + F as G and so on...
> >
> > In SQL I created views, and they refer to each other. From my query
> > with calculation I created 5 views, where view 2 use calculations
from
> > view 1, view 3 from view 2 and 1... and view 5 use view 1 to view
4. I
> > use those views in Stored Procedures with sum, average and LAST
which
> > doesn't exist in SQL. (So that is another view)
> >
> > All of that works but very slow.
> >
> > Is there any better way to handle this kind of calulations?|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegroups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a
> single view with all of the calcs you need...
> > Hi All,
> >
> > I am converting database from Access 2000 to SQL Server 2000.
> > I have very long calculations written in Access.
> > eg.
> > A+B as C, C+D as E, E + F as G and so on...
> >
> > In SQL I created views, and they refer to each other. From my query
> > with calculation I created 5 views, where view 2 use calculations
from
> > view 1, view 3 from view 2 and 1... and view 5 use view 1 to view
4. I
> > use those views in Stored Procedures with sum, average and LAST
which
> > doesn't exist in SQL. (So that is another view)
> >
> > All of that works but very slow.
> >
> > Is there any better way to handle this kind of calulations?
Labels:
access,
calculations,
converting,
database,
microsoft,
mysql,
oracle,
server,
sql,
written
Calculations in the SQL Server
Hi All,
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
SchapopaDeeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
>
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegroups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
>
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
I am converting database from Access 2000 to SQL Server 2000.
I have very long calculations written in Access.
eg.
A+B as C, C+D as E, E + F as G and so on...
In SQL I created views, and they refer to each other. From my query
with calculation I created 5 views, where view 2 use calculations from
view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
use those views in Stored Procedures with sum, average and LAST which
doesn't exist in SQL. (So that is another view)
All of that works but very slow.
Is there any better way to handle this kind of calulations?
Thank you
SchapopaDeeply nested views can be slow. It might be better to simply create a
single view with all of the calcs you need...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112614187.922629.116440@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am converting database from Access 2000 to SQL Server 2000.
> I have very long calculations written in Access.
> eg.
> A+B as C, C+D as E, E + F as G and so on...
> In SQL I created views, and they refer to each other. From my query
> with calculation I created 5 views, where view 2 use calculations from
> view 1, view 3 from view 2 and 1... and view 5 use view 1 to view 4. I
> use those views in Stored Procedures with sum, average and LAST which
> doesn't exist in SQL. (So that is another view)
> All of that works but very slow.
> Is there any better way to handle this kind of calulations?
> Thank you
> Schapopa
>|||Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
>
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]|||On 4 Apr 2005 07:32:33 -0700, schapopa wrote:
>Is there any other way. Those calculation are really big, and often
>contain divisions. (where I am checking if value = 0) I would say that
>it is impossible to create one view from those 5 views.
Hi schapopa,
I'm not sure if it helps in your case, but you could consider using
derived tables. Something like this:
SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500
You can even nest them. The example below ussees two levels of nesting,
but you can add more.
SELECT Expr1, Expr2, Expr3,
COALESCE(Expr3 / NULLIF(Expr1 - Expr2, 0), 0) AS Expr4
FROM (SELECT Expr1, Expr2, Expr1 + Expr2 AS Expr3
FROM (SELECT Col1 - Col2 AS Expr1, Col3 * Col4 AS Expr2, Col7
FROM SomeTable
WHERE Col5 > Col6) AS x
WHERE Expr1 <> Expr2
AND Expr2 + Col7 > 500) AS y
WHERE Expr3 = 18
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Look at using scalar user-defined functions.
Without seeing the calculations you are trying to perform, you should still
be able to build a base set of functions that you can nest. Then, create
one VIEW that puts them all together.
Sincerely,
Anthony Thomas
"schapopa" <areklubinski@.hotmail.com> wrote in message
news:1112625153.408751.17040@.g14g2000cwa.googlegroups.com...
Is there any other way. Those calculation are really big, and often
contain divisions. (where I am checking if value = 0) I would say that
it is impossible to create one view from those 5 views.
Wayne Snyder wrote:
> Deeply nested views can be slow. It might be better to simply create
a[vbcol=seagreen]
> single view with all of the calcs you need...
>
from[vbcol=seagreen]
4. I[vbcol=seagreen]
which[vbcol=seagreen]
Labels:
access,
calculations,
converting,
database,
microsoft,
mysql,
oracle,
server,
sql,
written
Sunday, February 12, 2012
Calculating Age based on Document Date in months
Hi, I'm trying to write a formula that will calculate a patient's age based on the visit date and then converting it into months. Anyone know how to do that?
The variables would be:
{DOCUMENT.CLINICALDATE}
{PERSON.DATEOFBIRTH}The next will calculate age in years
({DOCUMENT.CLINICALDATE} - {PERSON.DATEOFBIRTH}) / 365
The next will calculate age in months
({DOCUMENT.CLINICALDATE} - {PERSON.DATEOFBIRTH}) / 365 * 12
The variables would be:
{DOCUMENT.CLINICALDATE}
{PERSON.DATEOFBIRTH}The next will calculate age in years
({DOCUMENT.CLINICALDATE} - {PERSON.DATEOFBIRTH}) / 365
The next will calculate age in months
({DOCUMENT.CLINICALDATE} - {PERSON.DATEOFBIRTH}) / 365 * 12
Calculating a delta in a matrix
I'm converting a pivot table spreadsheet to a RS matrix. I'm have a problem
figuring out how to calculate a delta column in the matrix. The delta is the
difference of current to prior for hot and cold by type. The RS matrix has a
column and row subtotal and a column grand total. I could do the calculation
in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
The last three columns are what i need to get into the matrix.
Current Current Sum Prior Prior Sum Delta Total Delta
Type Strategy Code Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)Here's a better picture of the matrix
Cur CurSum Prior Prior Sum Delta Delta
Type Str Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)
"dbro101" wrote:
> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a problem
> figuring out how to calculate a delta column in the matrix. The delta is the
> difference of current to prior for hot and cold by type. The RS matrix has a
> column and row subtotal and a column grand total. I could do the calculation
> in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
> The last three columns are what i need to get into the matrix.
> Current Current Sum Prior Prior Sum Delta Total Delta
> Type Strategy Code Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
>|||I have a very similar issue, as posted on 5th July, "Calculations in Matrix
report"
It would appear a delta cannot be calculated within a Matrix. My issue is
currently being investigated to determine whether there is a workaround.
Pete
"dbro101" <dbro101@.discussions.microsoft.com> wrote in message
news:8FA5FF70-523E-4354-80B8-4B94F694E6F2@.microsoft.com...
> Here's a better picture of the matrix
>
> Cur CurSum Prior Prior Sum Delta Delta
> Type Str Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
> "dbro101" wrote:
>> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a
>> problem
>> figuring out how to calculate a delta column in the matrix. The delta is
>> the
>> difference of current to prior for hot and cold by type. The RS matrix
>> has a
>> column and row subtotal and a column grand total. I could do the
>> calculation
>> in the SQL statement. Any ideas/solutions on how to do it in the RS
>> matrix?
>> The last three columns are what i need to get into the matrix.
>> Current Current Sum Prior Prior Sum Delta Total Delta
>> Type Strategy Code Hot Cold Hot Cold Hot Cold
>> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
>> MNP 10 22 32 11 25 36 (1) (3) (4)
>> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
>> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
>> SBF 25 55 80 27 60 87 (2) (5) (7)
>> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
>> Grand Total 60 127 187 68 142 210 (6) (15) (21)
figuring out how to calculate a delta column in the matrix. The delta is the
difference of current to prior for hot and cold by type. The RS matrix has a
column and row subtotal and a column grand total. I could do the calculation
in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
The last three columns are what i need to get into the matrix.
Current Current Sum Prior Prior Sum Delta Total Delta
Type Strategy Code Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)Here's a better picture of the matrix
Cur CurSum Prior Prior Sum Delta Delta
Type Str Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)
"dbro101" wrote:
> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a problem
> figuring out how to calculate a delta column in the matrix. The delta is the
> difference of current to prior for hot and cold by type. The RS matrix has a
> column and row subtotal and a column grand total. I could do the calculation
> in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
> The last three columns are what i need to get into the matrix.
> Current Current Sum Prior Prior Sum Delta Total Delta
> Type Strategy Code Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
>|||I have a very similar issue, as posted on 5th July, "Calculations in Matrix
report"
It would appear a delta cannot be calculated within a Matrix. My issue is
currently being investigated to determine whether there is a workaround.
Pete
"dbro101" <dbro101@.discussions.microsoft.com> wrote in message
news:8FA5FF70-523E-4354-80B8-4B94F694E6F2@.microsoft.com...
> Here's a better picture of the matrix
>
> Cur CurSum Prior Prior Sum Delta Delta
> Type Str Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
> "dbro101" wrote:
>> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a
>> problem
>> figuring out how to calculate a delta column in the matrix. The delta is
>> the
>> difference of current to prior for hot and cold by type. The RS matrix
>> has a
>> column and row subtotal and a column grand total. I could do the
>> calculation
>> in the SQL statement. Any ideas/solutions on how to do it in the RS
>> matrix?
>> The last three columns are what i need to get into the matrix.
>> Current Current Sum Prior Prior Sum Delta Total Delta
>> Type Strategy Code Hot Cold Hot Cold Hot Cold
>> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
>> MNP 10 22 32 11 25 36 (1) (3) (4)
>> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
>> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
>> SBF 25 55 80 27 60 87 (2) (5) (7)
>> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
>> Grand Total 60 127 187 68 142 210 (6) (15) (21)
Subscribe to:
Posts (Atom)