Showing posts with label including. Show all posts
Showing posts with label including. Show all posts

Tuesday, March 27, 2012

Geographical realignment dimension

I have a fact table filled with clients including their address information as well as their original geographical alignment info (RegionID, DistrictID and TerritoryID). In order to forecast as well as perform an “as if” analysis, I need to be able to realign the accounts based on previous or future alignments. I have an alignment table (dimension) that maintains alignment information by year and quarter and I can join to this table using the ClientAddressID field as well as the Year and Quarter fields. I’d like to be able to make the Year and Quarter fields/join be variable so that I can perform realignments simply by changing the year/quarter.

Is this possible in SSAS or am I going to have to find another solution? Any help will be greatly appreciated...

David

I resolved this using a many to many relationship. This write-up was very useful: http://msdn2.microsoft.com/en-us/library/ms170463.aspx

David

Geographical realignment dimension

I have a fact table filled with clients including their address information as well as their original geographical alignment info (RegionID, DistrictID and TerritoryID). In order to forecast as well as perform an “as if” analysis, I need to be able to realign the accounts based on previous or future alignments. I have an alignment table (dimension) that maintains alignment information by year and quarter and I can join to this table using the ClientAddressID field as well as the Year and Quarter fields. I’d like to be able to make the Year and Quarter fields/join be variable so that I can perform realignments simply by changing the year/quarter.

Is this possible in SSAS or am I going to have to find another solution? Any help will be greatly appreciated...

David

I resolved this using a many to many relationship. This write-up was very useful: http://msdn2.microsoft.com/en-us/library/ms170463.aspx

David

sql

Monday, March 26, 2012

Generating XML Schema from db tables - including field lengths

I'm working on a C# project that essentially features a dump of the
database (on SQL Server 2005) into an XML file, with schema.
Basically we want the users to be able to take this data anywhere, as
easily as is possible. I initially selected the information "For XML
Auto" etc. etc. but found that when I tested simple imports of that
XML with the likes of Access and Excel, those programs didn't take
well to the schema at all.
Switching gears, I queried the databases normally and did the XML
conversion in C# using the dataset.writeXML function with schema,
which generated schema that made Access and Excel much happier. The
only thing is that Access, upon creating tables based on the schema,
took the string fields to be text, rather than memo. (i.e.
varchar(255) instead of text) ... likewise, SQL Server, when
wrestling to create tables based on the schema, behaves similarly.
Mind you, when the tables are created beforehand, and just populated
with the XML data, that's fine, it works great.
I do realize that's how it's supposed to work, but I'm being asked to
generate a schema that includes maxLength for varchar fields -- even
though I doubt any program that would be importing this data would
even be able to read that from the schema and use it appropriately.
I'm hoping someone here can tell me there's a nicer way of doing that
than SELECTing FOR XML RAW and drawing up an XSLT.
Takers?Did you use the xmlschema directive on FOR XML AUTO or RAW?
Best regards
Michael
"Matthew Dunphy" <leviathant@.gmail.com> wrote in message
news:1172246553.987853.109810@.j27g2000cwj.googlegroups.com...
> I'm working on a C# project that essentially features a dump of the
> database (on SQL Server 2005) into an XML file, with schema.
> Basically we want the users to be able to take this data anywhere, as
> easily as is possible. I initially selected the information "For XML
> Auto" etc. etc. but found that when I tested simple imports of that
> XML with the likes of Access and Excel, those programs didn't take
> well to the schema at all.
> Switching gears, I queried the databases normally and did the XML
> conversion in C# using the dataset.writeXML function with schema,
> which generated schema that made Access and Excel much happier. The
> only thing is that Access, upon creating tables based on the schema,
> took the string fields to be text, rather than memo. (i.e.
> varchar(255) instead of text) ... likewise, SQL Server, when
> wrestling to create tables based on the schema, behaves similarly.
> Mind you, when the tables are created beforehand, and just populated
> with the XML data, that's fine, it works great.
> I do realize that's how it's supposed to work, but I'm being asked to
> generate a schema that includes maxLength for varchar fields -- even
> though I doubt any program that would be importing this data would
> even be able to read that from the schema and use it appropriately.
> I'm hoping someone here can tell me there's a nicer way of doing that
> than SELECTing FOR XML RAW and drawing up an XSLT.
> Takers?
>|||Both -- when I used AUTO, it worked great except that it doesn't
output the maxlength for the varchar fields. Everything else it does
is kind of magical.
When I use RAW, it outputs each column, but again, nothing about the
(3000) for a row that is varchar(3000).
To be specific, the select statement that comes closest to what I want
looks basically like this:
SELECT *
FROM table
WHERE id=@.id
FOR XML AUTO, ELEMENTS, XMLDATA
(I do this for about a dozen tables)
In the resulting schema, the ElementType nodes have attributes for
name, content, model, and dt:type... is there some way to also specify
maxLength, based off the table schema in SQL server, so that I can do
a simple query like this -- or do I just have to bite the bullet and
write the schemas manually?
Thanks!
--Matt Dunphy
On Feb 24, 1:42 am, "Michael Rys [MSFT]" <m...@.online.microsoft.com>
wrote:
> Did you use the xmlschema directive on FOR XML AUTO or RAW?
> Best regards
> Michael
> "Matthew Dunphy" <leviath...@.gmail.com> wrote in message
> news:1172246553.987853.109810@.j27g2000cwj.googlegroups.com...
>
>
>
>|||Actually... never mind that last post, I think you've pointed me in
the right direction. (That's what I get for posting first thing in
the morning!) Thanks for your help.
On Feb 26, 9:14 am, "Matthew Dunphy" <leviath...@.gmail.com> wrote:
> Both -- when I used AUTO, it worked great except that it doesn't
> output the maxlength for the varchar fields. Everything else it does
> is kind of magical.
> When I use RAW, it outputs each column, but again, nothing about the
> (3000) for a row that is varchar(3000).
> To be specific, the select statement that comes closest to what I want
> looks basically like this:
> SELECT *
> FROM table
> WHERE id=@.id
> FOR XML AUTO, ELEMENTS, XMLDATA
> (I do this for about a dozen tables)
> In the resulting schema, the ElementType nodes have attributes for
> name, content, model, and dt:type... is there some way to also specify
> maxLength, based off the table schema in SQL server, so that I can do
> a simple query like this -- or do I just have to bite the bullet and
> write the schemas manually?
> Thanks!
> --Matt Dunphy
>

Generating XML Schema from db tables - including field lengths

I'm working on a C# project that essentially features a dump of the
database (on SQL Server 2005) into an XML file, with schema.
Basically we want the users to be able to take this data anywhere, as
easily as is possible. I initially selected the information "For XML
Auto" etc. etc. but found that when I tested simple imports of that
XML with the likes of Access and Excel, those programs didn't take
well to the schema at all.
Switching gears, I queried the databases normally and did the XML
conversion in C# using the dataset.writeXML function with schema,
which generated schema that made Access and Excel much happier. The
only thing is that Access, upon creating tables based on the schema,
took the string fields to be text, rather than memo. (i.e.
varchar(255) instead of text) ... likewise, SQL Server, when
wrestling to create tables based on the schema, behaves similarly.
Mind you, when the tables are created beforehand, and just populated
with the XML data, that's fine, it works great.
I do realize that's how it's supposed to work, but I'm being asked to
generate a schema that includes maxLength for varchar fields -- even
though I doubt any program that would be importing this data would
even be able to read that from the schema and use it appropriately.
I'm hoping someone here can tell me there's a nicer way of doing that
than SELECTing FOR XML RAW and drawing up an XSLT.
Takers?
Did you use the xmlschema directive on FOR XML AUTO or RAW?
Best regards
Michael
"Matthew Dunphy" <leviathant@.gmail.com> wrote in message
news:1172246553.987853.109810@.j27g2000cwj.googlegr oups.com...
> I'm working on a C# project that essentially features a dump of the
> database (on SQL Server 2005) into an XML file, with schema.
> Basically we want the users to be able to take this data anywhere, as
> easily as is possible. I initially selected the information "For XML
> Auto" etc. etc. but found that when I tested simple imports of that
> XML with the likes of Access and Excel, those programs didn't take
> well to the schema at all.
> Switching gears, I queried the databases normally and did the XML
> conversion in C# using the dataset.writeXML function with schema,
> which generated schema that made Access and Excel much happier. The
> only thing is that Access, upon creating tables based on the schema,
> took the string fields to be text, rather than memo. (i.e.
> varchar(255) instead of text) ... likewise, SQL Server, when
> wrestling to create tables based on the schema, behaves similarly.
> Mind you, when the tables are created beforehand, and just populated
> with the XML data, that's fine, it works great.
> I do realize that's how it's supposed to work, but I'm being asked to
> generate a schema that includes maxLength for varchar fields -- even
> though I doubt any program that would be importing this data would
> even be able to read that from the schema and use it appropriately.
> I'm hoping someone here can tell me there's a nicer way of doing that
> than SELECTing FOR XML RAW and drawing up an XSLT.
> Takers?
>
|||Both -- when I used AUTO, it worked great except that it doesn't
output the maxlength for the varchar fields. Everything else it does
is kind of magical.
When I use RAW, it outputs each column, but again, nothing about the
(3000) for a row that is varchar(3000).
To be specific, the select statement that comes closest to what I want
looks basically like this:
SELECT *
FROM table
WHERE id=@.id
FOR XML AUTO, ELEMENTS, XMLDATA
(I do this for about a dozen tables)
In the resulting schema, the ElementType nodes have attributes for
name, content, model, and dt:type... is there some way to also specify
maxLength, based off the table schema in SQL server, so that I can do
a simple query like this -- or do I just have to bite the bullet and
write the schemas manually?
Thanks!
--Matt Dunphy
On Feb 24, 1:42 am, "Michael Rys [MSFT]" <m...@.online.microsoft.com>
wrote:[vbcol=seagreen]
> Did you use the xmlschema directive on FOR XML AUTO or RAW?
> Best regards
> Michael
> "Matthew Dunphy" <leviath...@.gmail.com> wrote in message
> news:1172246553.987853.109810@.j27g2000cwj.googlegr oups.com...
>
>
|||Actually... never mind that last post, I think you've pointed me in
the right direction. (That's what I get for posting first thing in
the morning!) Thanks for your help.
On Feb 26, 9:14 am, "Matthew Dunphy" <leviath...@.gmail.com> wrote:
> Both -- when I used AUTO, it worked great except that it doesn't
> output the maxlength for the varchar fields. Everything else it does
> is kind of magical.
> When I use RAW, it outputs each column, but again, nothing about the
> (3000) for a row that is varchar(3000).
> To be specific, the select statement that comes closest to what I want
> looks basically like this:
> SELECT *
> FROM table
> WHERE id=@.id
> FOR XML AUTO, ELEMENTS, XMLDATA
> (I do this for about a dozen tables)
> In the resulting schema, the ElementType nodes have attributes for
> name, content, model, and dt:type... is there some way to also specify
> maxLength, based off the table schema in SQL server, so that I can do
> a simple query like this -- or do I just have to bite the bullet and
> write the schemas manually?
> Thanks!
> --Matt Dunphy
>

Friday, March 9, 2012

Generate SQL Script including actual Data

Hi NG
Is there a way to generate an SQL Script that not only includes database
structure but also the content / data of tables ?
helps appreciated
ChristianChristian
BACKUP\RESTORE commnads
"Christian" <chmug@.swissonline.ch> wrote in message
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>|||i can't figure out what you're talking about . could you give me some infos
?
Chris
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
> Christian
> BACKUP\RESTORE commnads
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>> Hi NG
>> Is there a way to generate an SQL Script that not only includes database
>> structure but also the content / data of tables ?
>> helps appreciated
>> Christian
>>
>|||Try QALite (Downloadable from the internet), i will provide you with a set
of functions to get additional Insert Statements for the data.
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>|||Sure
--We perfom a backup of the database
BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
--Now we restore the database with a new name
RESTORE DATABASE test_newname
FROM 'C:\mydatabase.bak'
WITH RECOVERY,
MOVE 'test_data' TO 'D:\Test_data.mdf',
MOVE 'test_log' TO 'D:\Test_log.ldf'
For more details please refer to the BOL
"Christian" <chmug@.swissonline.ch> wrote in message
news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
> i can't figure out what you're talking about . could you give me some
infos
> ?
> Chris
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
> > Christian
> > BACKUP\RESTORE commnads
> >
> >
> > "Christian" <chmug@.swissonline.ch> wrote in message
> > news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> >> Hi NG
> >>
> >> Is there a way to generate an SQL Script that not only includes
database
> >> structure but also the content / data of tables ?
> >>
> >> helps appreciated
> >>
> >> Christian
> >>
> >>
> >
> >
>|||Ok, downloaded and installed ... but where can i generate an SQL Script ?
My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Jens Süßmeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
> Try QALite (Downloadable from the internet), i will provide you with a set
> of functions to get additional Insert Statements for the data.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>> Hi NG
>> Is there a way to generate an SQL Script that not only includes database
>> structure but also the content / data of tables ?
>> helps appreciated
>> Christian
>|||My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uojSeDVUFHA.928@.TK2MSFTNGP15.phx.gbl...
> Sure
> --We perfom a backup of the database
> BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
> --Now we restore the database with a new name
> RESTORE DATABASE test_newname
> FROM 'C:\mydatabase.bak'
> WITH RECOVERY,
> MOVE 'test_data' TO 'D:\Test_data.mdf',
> MOVE 'test_log' TO 'D:\Test_log.ldf'
> For more details please refer to the BOL
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
>> i can't figure out what you're talking about . could you give me some
> infos
>> ?
>> Chris
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
>> > Christian
>> > BACKUP\RESTORE commnads
>> >
>> >
>> > "Christian" <chmug@.swissonline.ch> wrote in message
>> > news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>> >> Hi NG
>> >>
>> >> Is there a way to generate an SQL Script that not only includes
> database
>> >> structure but also the content / data of tables ?
>> >>
>> >> helps appreciated
>> >>
>> >> Christian
>> >>
>> >>
>> >
>> >
>>
>|||DOn´t know how many tables you´ve got... but there is a qay to script a
single table in QA, right click on the Table --> DDL and inserts.
Jens SUessmeyer.
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:eApftPVUFHA.548@.tk2msftngp13.phx.gbl...
> Ok, downloaded and installed ... but where can i generate an SQL Script ?
> My intension / target
> i've a database with content. i wan't the whole database structure INCL.
> the data i a SQL Script .. i don't wanna backup / restore the database! my
> target is to have a SQL-Script!
> Christian
> "Jens Süßmeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
>> Try QALite (Downloadable from the internet), i will provide you with a
>> set of functions to get additional Insert Statements for the data.
>> HTH, Jens Suessmeyer.
>> --
>> http://www.sqlserver2005.de
>> --
>>
>> "Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
>> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>> Hi NG
>> Is there a way to generate an SQL Script that not only includes database
>> structure but also the content / data of tables ?
>> helps appreciated
>> Christian
>>
>|||try the free data and schema scripter from Innovartis. It comes free with the
evaluation of DB Ghost -
http://www.innovartis.co.uk/database_change_management_evaluation.aspx
regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Build, Comparison and Synchronization from Source Control = Database change
management for SQL Server
"Christian" wrote:
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>
>

Generate SQL Script including actual Data

Hi NG
Is there a way to generate an SQL Script that not only includes database
structure but also the content / data of tables ?
helps appreciated
ChristianChristian
BACKUP\RESTORE commnads
"Christian" <chmug@.swissonline.ch> wrote in message
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>|||i can't figure out what you're talking about . could you give me some infos
?
Chris
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
> Christian
> BACKUP\RESTORE commnads
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>|||Try QALite (Downloadable from the internet), i will provide you with a set
of functions to get additional Insert Statements for the data.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>|||Sure
--We perfom a backup of the database
BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
--Now we restore the database with a new name
RESTORE DATABASE test_newname
FROM 'C:\mydatabase.bak'
WITH RECOVERY,
MOVE 'test_data' TO 'D:\Test_data.mdf',
MOVE 'test_log' TO 'D:\Test_log.ldf'
For more details please refer to the BOL
"Christian" <chmug@.swissonline.ch> wrote in message
news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
> i can't figure out what you're talking about . could you give me some
infos
> ?
> Chris
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
database[vbcol=seagreen]
>|||Ok, downloaded and installed ... but where can i generate an SQL Script ?
My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
> Try QALite (Downloadable from the internet), i will provide you with a set
> of functions to get additional Insert Statements for the data.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>|||My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uojSeDVUFHA.928@.TK2MSFTNGP15.phx.gbl...
> Sure
> --We perfom a backup of the database
> BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
> --Now we restore the database with a new name
> RESTORE DATABASE test_newname
> FROM 'C:\mydatabase.bak'
> WITH RECOVERY,
> MOVE 'test_data' TO 'D:\Test_data.mdf',
> MOVE 'test_log' TO 'D:\Test_log.ldf'
> For more details please refer to the BOL
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
> infos
> database
>|||DOnt know how many tables youve got... but there is a qay to script a
single table in QA, right click on the Table --> DDL and inserts.
Jens SUessmeyer.
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:eApftPVUFHA.548@.tk2msftngp13.phx.gbl...
> Ok, downloaded and installed ... but where can i generate an SQL Script ?
> My intension / target
> i've a database with content. i wan't the whole database structure INCL.
> the data i a SQL Script .. i don't wanna backup / restore the database! my
> target is to have a SQL-Script!
> Christian
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
>|||try the free data and schema scripter from Innovartis. It comes free with th
e
evaluation of DB Ghost -
http://www.innovartis.co.uk/databas...evaluation.aspx
regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Build, Comparison and Synchronization from Source Control = Database change
management for SQL Server
"Christian" wrote:

> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>
>

Generate SQL Script including actual Data

Hi NG
Is there a way to generate an SQL Script that not only includes database
structure but also the content / data of tables ?
helps appreciated
Christian
Christian
BACKUP\RESTORE commnads
"Christian" <chmug@.swissonline.ch> wrote in message
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>
|||i can't figure out what you're talking about . could you give me some infos
?
Chris
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
> Christian
> BACKUP\RESTORE commnads
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>
|||Try QALite (Downloadable from the internet), i will provide you with a set
of functions to get additional Insert Statements for the data.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>
|||Sure
--We perfom a backup of the database
BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
--Now we restore the database with a new name
RESTORE DATABASE test_newname
FROM 'C:\mydatabase.bak'
WITH RECOVERY,
MOVE 'test_data' TO 'D:\Test_data.mdf',
MOVE 'test_log' TO 'D:\Test_log.ldf'
For more details please refer to the BOL
"Christian" <chmug@.swissonline.ch> wrote in message
news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
> i can't figure out what you're talking about . could you give me some
infos[vbcol=seagreen]
> ?
> Chris
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:O1wkL1UUFHA.3944@.tk2msftngp13.phx.gbl...
database
>
|||Ok, downloaded and installed ... but where can i generate an SQL Script ?
My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
> Try QALite (Downloadable from the internet), i will provide you with a set
> of functions to get additional Insert Statements for the data.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
> news:e6efCvUUFHA.548@.tk2msftngp13.phx.gbl...
>
|||My intension / target
i've a database with content. i wan't the whole database structure INCL. the
data i a SQL Script .. i don't wanna backup / restore the database! my
target is to have a SQL-Script!
Christian
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uojSeDVUFHA.928@.TK2MSFTNGP15.phx.gbl...
> Sure
> --We perfom a backup of the database
> BACKUP DATABASE test TO DISK='C:\mydatabase.bak'
> --Now we restore the database with a new name
> RESTORE DATABASE test_newname
> FROM 'C:\mydatabase.bak'
> WITH RECOVERY,
> MOVE 'test_data' TO 'D:\Test_data.mdf',
> MOVE 'test_log' TO 'D:\Test_log.ldf'
> For more details please refer to the BOL
>
> "Christian" <chmug@.swissonline.ch> wrote in message
> news:OdSr26UUFHA.3952@.TK2MSFTNGP15.phx.gbl...
> infos
> database
>
|||DOnt know how many tables youve got... but there is a qay to script a
single table in QA, right click on the Table --> DDL and inserts.
Jens SUessmeyer.
"Christian" <chmug@.swissonline.ch> schrieb im Newsbeitrag
news:eApftPVUFHA.548@.tk2msftngp13.phx.gbl...
> Ok, downloaded and installed ... but where can i generate an SQL Script ?
> My intension / target
> i've a database with content. i wan't the whole database structure INCL.
> the data i a SQL Script .. i don't wanna backup / restore the database! my
> target is to have a SQL-Script!
> Christian
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:ee67X9UUFHA.2892@.TK2MSFTNGP14.phx.gbl...
>
|||try the free data and schema scripter from Innovartis. It comes free with the
evaluation of DB Ghost -
http://www.innovartis.co.uk/database...valuation.aspx
regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Build, Comparison and Synchronization from Source Control = Database change
management for SQL Server
"Christian" wrote:

> Hi NG
> Is there a way to generate an SQL Script that not only includes database
> structure but also the content / data of tables ?
> helps appreciated
> Christian
>
>

Wednesday, March 7, 2012

Generate SQL for a table

Hi

I have two questions

i) is there any SP which will generates SQL Script for a table including all constarint(PK,FK), index etc. and the table data in the format of "INSERT INTO" . if NO, how can i create to do so, or any other SP which will help me( may be third party one)

ii)Where had "Scptxfr.exe" gone in SQL Server 2005 ?

Regards,

Thanks.

Gurpreet S. Gill

There is no SP. You will have to create one yourself or use SMO for example. I don't know the answer to the 2nd one. I am moving the thread to Tools forum to see if someone there might know.|||

Gurpreet Singh Gill wrote:

Hi

I have two questions

i) is there any SP which will generates SQL Script for a table including all constarint(PK,FK), index etc. and the table data in the format of "INSERT INTO" . if NO, how can i create to do so, or any other SP which will help me( may be third party one)

ii)Where had "Scptxfr.exe" gone in SQL Server 2005 ?

Regards,

Thanks.

Gurpreet S. Gill

Hi,

if you are a .Net developer the insert scripts are already genrated for you by the wizard if you have pk in every tables. You might be interested in using it. even if you are not a VS developer

the answer to the second question is just a click away. here. check this out

look for this topic Where to Find SCPTXFR?

http://www.sqlservercentral.com/columnists/jreade/howtoscheduleasqlserverdatabasecreationscript.asp

thanks,

joey

|||

joey

I dont want to create it by .NET code infact only by using the some SP, or inside SSMS only.

I read the artical but i dont find any thing about where is the SCPTXFR.EXE had gone, only one line say, "this is missing", but they are refering the Beta version of SQL Server.

Regards,

Thanks.

Gurpreet S. Gill

|||

the title is misleading. sorry

anyway you can still use the v2000 version of scptxfr.exe

with 2005

|||

I know about scptxfr.exe, I want only one table Script(not all), with Data too.

|||

hi,

got this one from another thread

you can use the sql server wizard to generate scripts insert, update, delete query

Run sql server enterprise manager > tools > wizards > database > create stored procedures wizards.

choose the table and click on insert.

on the completing tab click on edit then click edit Sql

regards,

joey

|||

Sorry to say man, i want to create the SP which will Generate the SQL Script(including Constaints, indexes, checks..etc) for the table as well as the data of that table. The aim is to create the .sql file, which can be used for migration to other DB with the table(create script) with data.

|||I was struggling with the same case a few months back in SQL Server 2005 as the wizard does not include drop statements before creating the object. Unlike SQL Server 2000, the 2005 version uses the IF NOT EXISTS logic instead of the IF EXISTS logic. This is where chanced upon Scriptio, a tool created by SQLTeam.com. From the looks of your requirement, you definitely have to write a script (or an application) to generate an INSERT Statement if you want to migrate the data as well. Why don't you just generate a script to build the database and use SSIS to migrate the data afterwards?|||

Basically, the things are bit different for me, we had a setup at client end, which uses the SQL Server 2005 as a backend(before that the application was using the SQL Base by Centura/Gurpta Technologies).Client dont have SSMS(only Database Services), infact they are using the SQL Talk(again the tool from the same). they want the same funcrionalties as provided by SQL Base, this procedure, which i need is one of them

Could any body help me.

Regards,

Thanks.

Gurpreet S. Gill

Generate Script including Data

Hello Group:
Is there any way of generate a script which include data and database
structure in SQL SERVER 2000?
Thanks in advance.
Armando
http://www.karaszi.com/SQLServer/inf...ate_script.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Armando Ruiz" <armando-ruiz@.telefonica.net> wrote in message
news:OfzTF$7AFHA.1992@.TK2MSFTNGP10.phx.gbl...
> Hello Group:
> Is there any way of generate a script which include data and database
> structure in SQL SERVER 2000?
> Thanks in advance.
> Armando
>
|||Hi Armando,
Would you be able to tell us the exact purpose? There are other better ways
to do it.
Thanks
Yogish
|||Hello and thanks for your quick answers.
I've to update a remote MSDE database, creating 4 new tables and inserting
data.
I cant use DTS, Export Data, etc., so I'm looking an easy way to update
that database only by 1 step.
Thanks again
Armando
"Yogish" <yogishkamathg@.icqmail.com> escribi en el mensaje
news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> Hi Armando,
> Would you be able to tell us the exact purpose? There are other better
ways
> to do it.
> --
> Thanks
> Yogish
|||check out DB Ghost - http://www.dbghost.com for scripting, building,
comparing and synchronizing both schema and data optionally using Source
control.
"Armando Ruiz" wrote:

> Hello and thanks for your quick answers.
> I've to update a remote MSDE database, creating 4 new tables and inserting
> data.
> I can′t use DTS, Export Data, etc., so I'm looking an easy way to update
> that database only by 1 step.
> Thanks again
> Armando
>
> "Yogish" <yogishkamathg@.icqmail.com> escribió en el mensaje
> news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> ways
>
>
|||Thanks for the reply .
"mark baekdal" <markbaekdal@.discussions.microsoft.com> escribi en el
mensaje news:8F801F86-AD4A-4D1C-90CA-4CC4619D86FB@.microsoft.com...[vbcol=seagreen]
> check out DB Ghost - http://www.dbghost.com for scripting, building,
> comparing and synchronizing both schema and data optionally using Source
> control.
> "Armando Ruiz" wrote:
inserting[vbcol=seagreen]

Generate Script including Data

Hello Group:
Is there any way of generate a script which include data and database
structure in SQL SERVER 2000?
Thanks in advance.
Armandohttp://www.karaszi.com/SQLServer/in...rate_script.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Armando Ruiz" <armando-ruiz@.telefonica.net> wrote in message
news:OfzTF$7AFHA.1992@.TK2MSFTNGP10.phx.gbl...
> Hello Group:
> Is there any way of generate a script which include data and database
> structure in SQL SERVER 2000?
> Thanks in advance.
> Armando
>|||Hi Armando,
Would you be able to tell us the exact purpose? There are other better ways
to do it.
Thanks
Yogish|||Hello and thanks for your quick answers.
I've to update a remote MSDE database, creating 4 new tables and inserting
data.
I cant use DTS, Export Data, etc., so I'm looking an easy way to update
that database only by 1 step.
Thanks again
Armando
"Yogish" <yogishkamathg@.icqmail.com> escribi en el mensaje
news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> Hi Armando,
> Would you be able to tell us the exact purpose? There are other better
ways
> to do it.
> --
> Thanks
> Yogish|||check out DB Ghost - http://www.dbghost.com for scripting, building,
comparing and synchronizing both schema and data optionally using Source
control.
"Armando Ruiz" wrote:

> Hello and thanks for your quick answers.
> I've to update a remote MSDE database, creating 4 new tables and inserting
> data.
> I can′t use DTS, Export Data, etc., so I'm looking an easy way to update
> that database only by 1 step.
> Thanks again
> Armando
>
> "Yogish" <yogishkamathg@.icqmail.com> escribió en el mensaje
> news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> ways
>
>|||Thanks for the reply .
"mark baekdal" <markbaekdal@.discussions.microsoft.com> escribi en el
mensaje news:8F801F86-AD4A-4D1C-90CA-4CC4619D86FB@.microsoft.com...[vbcol=seagreen]
> check out DB Ghost - http://www.dbghost.com for scripting, building,
> comparing and synchronizing both schema and data optionally using Source
> control.
> "Armando Ruiz" wrote:
>
inserting[vbcol=seagreen]

Generate Script including Data

Hello Group:
Is there any way of generate a script which include data and database
structure in SQL SERVER 2000?
Thanks in advance.
Armandohttp://www.karaszi.com/SQLServer/info_generate_script.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Armando Ruiz" <armando-ruiz@.telefonica.net> wrote in message
news:OfzTF$7AFHA.1992@.TK2MSFTNGP10.phx.gbl...
> Hello Group:
> Is there any way of generate a script which include data and database
> structure in SQL SERVER 2000?
> Thanks in advance.
> Armando
>|||Hi Armando,
Would you be able to tell us the exact purpose? There are other better ways
to do it.
--
Thanks
Yogish|||Hello and thanks for your quick answers.
I've to update a remote MSDE database, creating 4 new tables and inserting
data.
I can´t use DTS, Export Data, etc., so I'm looking an easy way to update
that database only by 1 step.
Thanks again
Armando
"Yogish" <yogishkamathg@.icqmail.com> escribió en el mensaje
news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> Hi Armando,
> Would you be able to tell us the exact purpose? There are other better
ways
> to do it.
> --
> Thanks
> Yogish|||check out DB Ghost - http://www.dbghost.com for scripting, building,
comparing and synchronizing both schema and data optionally using Source
control.
"Armando Ruiz" wrote:
> Hello and thanks for your quick answers.
> I've to update a remote MSDE database, creating 4 new tables and inserting
> data.
> I can´t use DTS, Export Data, etc., so I'm looking an easy way to update
> that database only by 1 step.
> Thanks again
> Armando
>
> "Yogish" <yogishkamathg@.icqmail.com> escribió en el mensaje
> news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> > Hi Armando,
> >
> > Would you be able to tell us the exact purpose? There are other better
> ways
> > to do it.
> >
> > --
> > Thanks
> > Yogish
>
>|||Thanks for the reply .
"mark baekdal" <markbaekdal@.discussions.microsoft.com> escribió en el
mensaje news:8F801F86-AD4A-4D1C-90CA-4CC4619D86FB@.microsoft.com...
> check out DB Ghost - http://www.dbghost.com for scripting, building,
> comparing and synchronizing both schema and data optionally using Source
> control.
> "Armando Ruiz" wrote:
> > Hello and thanks for your quick answers.
> >
> > I've to update a remote MSDE database, creating 4 new tables and
inserting
> > data.
> >
> > I can´t use DTS, Export Data, etc., so I'm looking an easy way to update
> > that database only by 1 step.
> >
> > Thanks again
> >
> > Armando
> >
> >
> >
> > "Yogish" <yogishkamathg@.icqmail.com> escribió en el mensaje
> > news:E9EBED22-3D66-4DCB-B91E-8DCF5FAE25A8@.microsoft.com...
> > > Hi Armando,
> > >
> > > Would you be able to tell us the exact purpose? There are other better
> > ways
> > > to do it.
> > >
> > > --
> > > Thanks
> > > Yogish
> >
> >
> >

Friday, February 24, 2012

generate db scrip including data in tables

i'm not able to generate a sql script with the data in the tables! using sql express.

i need this script to ganerate the same database with its datas in a new sql server.

thanks in advance

SQL Server only generates scripts for schema and not for data. There are 3rd party tools that can do that. You can either build a DTS package or use DTS Import Export wizard to transfer data across servers. If the tables are huge (tens of millions of rows or higher) the DTS/Import could be slower.

|||

Can u just take a backup of the database on the source server and restore it on the destination server. This is of course possible if you need the entire database. Unfortunately, you can't create a script or something for data in the database like the script for the definitions of the objects (tables, stored procedures, views etc.). DTS packages are another solution as suggested by ndinakar.