Showing posts with label similar. Show all posts
Showing posts with label similar. Show all posts

Thursday, March 22, 2012

Creating a table by executing a storedproc

It is possible to create a table by executing a storedproc, similar to using
the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
execution a a storedproc.
thanks in advanceIt is not possible.
You may have to create the table and then yo can use an EXEC Sproc to
populate it with the Result Set.
You may use Base Table or a # Table to populate but not the @.Table.
--
HTH
Satish Balusa
Corillian Corp.
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
> It is possible to create a table by executing a storedproc, similar to
using
> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>|||It's possible by creating table first covering all the columns displayed by
the sotred procedure:
create table test (col1, col2, col3...)
insert into table exec ('stored proc')
richard
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
> It is possible to create a table by executing a storedproc, similar to
using
> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>|||A workaround is to use OPENROWSET or OPENQUERY:
SELECT * INTO #tmp
FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
SELECT * FROM #tmp
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
> It is possible to create a table by executing a storedproc, similar to using
> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>|||Thanks, this is exactly wat I was looking for.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:O9U1m#Y5DHA.2392@.TK2MSFTNGP11.phx.gbl...
> A workaround is to use OPENROWSET or OPENQUERY:
> SELECT * INTO #tmp
> FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
> SELECT * FROM #tmp
>
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
>
> "Benoit Drapeau" <review@.videotron.ca> wrote in message
> news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
> > It is possible to create a table by executing a storedproc, similar to
using
> > the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by
the
> > execution a a storedproc.
> >
> > thanks in advance
> >
> >
>

Creating a table by executing a storedproc

It is possible to create a table by executing a storedproc, similar to using
the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
execution a a storedproc.
thanks in advanceIt is not possible.
You may have to create the table and then yo can use an EXEC Sproc to
populate it with the Result Set.
You may use Base Table or a # Table to populate but not the @.Table.
HTH
Satish Balusa
Corillian Corp.
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to

using
quote:

> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||It's possible by creating table first covering all the columns displayed by
the sotred procedure:
create table test (col1, col2, col3...)
insert into table exec ('stored proc')
richard
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to

using
quote:

> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||A workaround is to use OPENROWSET or OPENQUERY:
SELECT * INTO #tmp
FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
SELECT * FROM #tmp
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to usi
ng
> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||Thanks, this is exactly wat I was looking for.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:O9U1m#Y5DHA.2392@.TK2MSFTNGP11.phx.gbl...
quote:

> A workaround is to use OPENROWSET or OPENQUERY:
> SELECT * INTO #tmp
> FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
> SELECT * FROM #tmp
>
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:

http://groups.google.com/groups?oi=...ublic.sqlserver
quote:

>
> "Benoit Drapeau" <review@.videotron.ca> wrote in message
> news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
using[QUOTE]
the[QUOTE]
>

Wednesday, March 7, 2012

Creating a Dimension Table from a 3-key table

Hi All,

I have a situation with a table that was created for a transactional

system with a 3 columns key. The table is similar to the following:

country state city description
1 12 21 City A from country 1 and state 12
1 13 21 City A from country 1 and state 13
2 14 22 City B from country 2 and state 14
2 15 22 City B from country 2 and state 15

Now I'm trying to create a dts package that would allow me to build a

city dimension table with unique codes (keys) for each city. What kind of

transformation should I use to translate the old codes (based on the

country-state-city key) into the new ones and preserving the data

integrity?

Thanks,

Ignaciodoesn't that defeat the purpose of building a cube?

What's it going to be for?

How are you going to go after the data?|||This cube is going to show sales history since 2002. The table where data is being pulled could contain data as the following:

cust_id year country state city amount_cash amount_credit
525 2002 1 12 21 8500 3200
714 2002 1 13 21 3250 775

Let's say I create a fact table with fk and measures only. If I would like to know city totals, it looks like cities sharing the same id will be aggregated, when in fact they shouldn't. And in the other hand, cities that are geographically shared by different states will add up correctly. Maybe I need to further analyze this, but what first puzzled me was the city table with no unique id.

Thanks for your thoughts!

Ignacio