Hi just wondering if there is a way to have a script that creates a table
write in a desired string for the first table entry?
I have an application that I am allowing the de-activation of a record. I
could not allow a delete since this could result in an orphan record. So
basically the table at startup (when first created) would look like
****************************
* pri key * varchar (20)*
****************************
* 1 * Not Active *
****************************
the application would add records to the table as it is used.
Paul G
Software engineer.
Paul, I'm not clear on what you need.
if not exists (select 'x' from information_schema.tables where table_name =
'mytable' and table_type = 'base table')
create table mytable (id int identity(1,1), status varchar(20))
if not exists (select 'x' from mytable)
insert into mytable (status) select 'Not Active'
Is this close?
Also, do you not have foreign key constraints defined in your data model?
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> Hi just wondering if there is a way to have a script that creates a table
> write in a desired string for the first table entry?
> I have an application that I am allowing the de-activation of a record. I
> could not allow a delete since this could result in an orphan record. So
> basically the table at startup (when first created) would look like
> ****************************
> * pri key * varchar (20)*
> ****************************
> * 1 * Not Active *
> ****************************
> the application would add records to the table as it is used.
>
> --
> Paul G
> Software engineer.
|||Hi thanks for the response. Its primary key is a foriegn key in another
table, this is why I can not delete a record. I also have a few constraints,
below is from Query analyzer script object. Just would like to put in for
the first record the string "Not Active" so perhaps what you listed should
work.
CREATE TABLE [DML$POC_T] (
[POC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[POC_Name_VC] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
CONSTRAINT [PK_DML$POC_T] PRIMARY KEY CLUSTERED
(
[POC_ID]
) ON [PRIMARY] ,
CONSTRAINT [IX_DML$POC_T] UNIQUE NONCLUSTERED
(
[POC_Name_VC]
) ON [PRIMARY]
) ON [PRIMARY]
GO
"Armando Prato" wrote:
> Paul, I'm not clear on what you need.
> if not exists (select 'x' from information_schema.tables where table_name =
> 'mytable' and table_type = 'base table')
> create table mytable (id int identity(1,1), status varchar(20))
> if not exists (select 'x' from mytable)
> insert into mytable (status) select 'Not Active'
> Is this close?
> Also, do you not have foreign key constraints defined in your data model?
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
>
>
Showing posts with label creates. Show all posts
Showing posts with label creates. Show all posts
Monday, March 26, 2012
forcing string value in table
Hi just wondering if there is a way to have a script that creates a table
write in a desired string for the first table entry?
I have an application that I am allowing the de-activation of a record. I
could not allow a delete since this could result in an orphan record. So
basically the table at startup (when first created) would look like
****************************
* pri key * varchar (20)*
****************************
* 1 * Not Active *
****************************
the application would add records to the table as it is used.
Paul G
Software engineer.Paul, I'm not clear on what you need.
if not exists (select 'x' from information_schema.tables where table_name =
'mytable' and table_type = 'base table')
create table mytable (id int identity(1,1), status varchar(20))
if not exists (select 'x' from mytable)
insert into mytable (status) select 'Not Active'
Is this close?
Also, do you not have foreign key constraints defined in your data model?
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> Hi just wondering if there is a way to have a script that creates a table
> write in a desired string for the first table entry?
> I have an application that I am allowing the de-activation of a record. I
> could not allow a delete since this could result in an orphan record. So
> basically the table at startup (when first created) would look like
> ****************************
> * pri key * varchar (20)*
> ****************************
> * 1 * Not Active *
> ****************************
> the application would add records to the table as it is used.
>
> --
> Paul G
> Software engineer.|||Hi thanks for the response. Its primary key is a foriegn key in another
table, this is why I can not delete a record. I also have a few constraints
,
below is from Query analyzer script object. Just would like to put in for
the first record the string "Not Active" so perhaps what you listed should
work.
CREATE TABLE [DML$POC_T] (
[POC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[POC_Name_VC] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NO
T NULL ,
CONSTRAINT [PK_DML$POC_T] PRIMARY KEY CLUSTERED
(
[POC_ID]
) ON [PRIMARY] ,
CONSTRAINT [IX_DML$POC_T] UNIQUE NONCLUSTERED
(
[POC_Name_VC]
) ON [PRIMARY]
) ON [PRIMARY]
GO
"Armando Prato" wrote:
> Paul, I'm not clear on what you need.
> if not exists (select 'x' from information_schema.tables where table_name
=
> 'mytable' and table_type = 'base table')
> create table mytable (id int identity(1,1), status varchar(20))
> if not exists (select 'x' from mytable)
> insert into mytable (status) select 'Not Active'
> Is this close?
> Also, do you not have foreign key constraints defined in your data model?
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
>
>
write in a desired string for the first table entry?
I have an application that I am allowing the de-activation of a record. I
could not allow a delete since this could result in an orphan record. So
basically the table at startup (when first created) would look like
****************************
* pri key * varchar (20)*
****************************
* 1 * Not Active *
****************************
the application would add records to the table as it is used.
Paul G
Software engineer.Paul, I'm not clear on what you need.
if not exists (select 'x' from information_schema.tables where table_name =
'mytable' and table_type = 'base table')
create table mytable (id int identity(1,1), status varchar(20))
if not exists (select 'x' from mytable)
insert into mytable (status) select 'Not Active'
Is this close?
Also, do you not have foreign key constraints defined in your data model?
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> Hi just wondering if there is a way to have a script that creates a table
> write in a desired string for the first table entry?
> I have an application that I am allowing the de-activation of a record. I
> could not allow a delete since this could result in an orphan record. So
> basically the table at startup (when first created) would look like
> ****************************
> * pri key * varchar (20)*
> ****************************
> * 1 * Not Active *
> ****************************
> the application would add records to the table as it is used.
>
> --
> Paul G
> Software engineer.|||Hi thanks for the response. Its primary key is a foriegn key in another
table, this is why I can not delete a record. I also have a few constraints
,
below is from Query analyzer script object. Just would like to put in for
the first record the string "Not Active" so perhaps what you listed should
work.
CREATE TABLE [DML$POC_T] (
[POC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[POC_Name_VC] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NO
T NULL ,
CONSTRAINT [PK_DML$POC_T] PRIMARY KEY CLUSTERED
(
[POC_ID]
) ON [PRIMARY] ,
CONSTRAINT [IX_DML$POC_T] UNIQUE NONCLUSTERED
(
[POC_Name_VC]
) ON [PRIMARY]
) ON [PRIMARY]
GO
"Armando Prato" wrote:
> Paul, I'm not clear on what you need.
> if not exists (select 'x' from information_schema.tables where table_name
=
> 'mytable' and table_type = 'base table')
> create table mytable (id int identity(1,1), status varchar(20))
> if not exists (select 'x' from mytable)
> insert into mytable (status) select 'Not Active'
> Is this close?
> Also, do you not have foreign key constraints defined in your data model?
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
>
>
forcing string value in table
Hi just wondering if there is a way to have a script that creates a table
write in a desired string for the first table entry?
I have an application that I am allowing the de-activation of a record. I
could not allow a delete since this could result in an orphan record. So
basically the table at startup (when first created) would look like
****************************
* pri key * varchar (20)*
****************************
* 1 * Not Active *
****************************
the application would add records to the table as it is used.
--
Paul G
Software engineer.Paul, I'm not clear on what you need.
if not exists (select 'x' from information_schema.tables where table_name ='mytable' and table_type = 'base table')
create table mytable (id int identity(1,1), status varchar(20))
if not exists (select 'x' from mytable)
insert into mytable (status) select 'Not Active'
Is this close?
Also, do you not have foreign key constraints defined in your data model?
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> Hi just wondering if there is a way to have a script that creates a table
> write in a desired string for the first table entry?
> I have an application that I am allowing the de-activation of a record. I
> could not allow a delete since this could result in an orphan record. So
> basically the table at startup (when first created) would look like
> ****************************
> * pri key * varchar (20)*
> ****************************
> * 1 * Not Active *
> ****************************
> the application would add records to the table as it is used.
>
> --
> Paul G
> Software engineer.|||Hi thanks for the response. Its primary key is a foriegn key in another
table, this is why I can not delete a record. I also have a few constraints,
below is from Query analyzer script object. Just would like to put in for
the first record the string "Not Active" so perhaps what you listed should
work.
CREATE TABLE [DML$POC_T] (
[POC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[POC_Name_VC] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
CONSTRAINT [PK_DML$POC_T] PRIMARY KEY CLUSTERED
(
[POC_ID]
) ON [PRIMARY] ,
CONSTRAINT [IX_DML$POC_T] UNIQUE NONCLUSTERED
(
[POC_Name_VC]
) ON [PRIMARY]
) ON [PRIMARY]
GO
"Armando Prato" wrote:
> Paul, I'm not clear on what you need.
> if not exists (select 'x' from information_schema.tables where table_name => 'mytable' and table_type = 'base table')
> create table mytable (id int identity(1,1), status varchar(20))
> if not exists (select 'x' from mytable)
> insert into mytable (status) select 'Not Active'
> Is this close?
> Also, do you not have foreign key constraints defined in your data model?
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> > Hi just wondering if there is a way to have a script that creates a table
> > write in a desired string for the first table entry?
> > I have an application that I am allowing the de-activation of a record. I
> > could not allow a delete since this could result in an orphan record. So
> > basically the table at startup (when first created) would look like
> > ****************************
> > * pri key * varchar (20)*
> > ****************************
> > * 1 * Not Active *
> > ****************************
> > the application would add records to the table as it is used.
> >
> >
> > --
> > Paul G
> > Software engineer.
>
>
write in a desired string for the first table entry?
I have an application that I am allowing the de-activation of a record. I
could not allow a delete since this could result in an orphan record. So
basically the table at startup (when first created) would look like
****************************
* pri key * varchar (20)*
****************************
* 1 * Not Active *
****************************
the application would add records to the table as it is used.
--
Paul G
Software engineer.Paul, I'm not clear on what you need.
if not exists (select 'x' from information_schema.tables where table_name ='mytable' and table_type = 'base table')
create table mytable (id int identity(1,1), status varchar(20))
if not exists (select 'x' from mytable)
insert into mytable (status) select 'Not Active'
Is this close?
Also, do you not have foreign key constraints defined in your data model?
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> Hi just wondering if there is a way to have a script that creates a table
> write in a desired string for the first table entry?
> I have an application that I am allowing the de-activation of a record. I
> could not allow a delete since this could result in an orphan record. So
> basically the table at startup (when first created) would look like
> ****************************
> * pri key * varchar (20)*
> ****************************
> * 1 * Not Active *
> ****************************
> the application would add records to the table as it is used.
>
> --
> Paul G
> Software engineer.|||Hi thanks for the response. Its primary key is a foriegn key in another
table, this is why I can not delete a record. I also have a few constraints,
below is from Query analyzer script object. Just would like to put in for
the first record the string "Not Active" so perhaps what you listed should
work.
CREATE TABLE [DML$POC_T] (
[POC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[POC_Name_VC] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
CONSTRAINT [PK_DML$POC_T] PRIMARY KEY CLUSTERED
(
[POC_ID]
) ON [PRIMARY] ,
CONSTRAINT [IX_DML$POC_T] UNIQUE NONCLUSTERED
(
[POC_Name_VC]
) ON [PRIMARY]
) ON [PRIMARY]
GO
"Armando Prato" wrote:
> Paul, I'm not clear on what you need.
> if not exists (select 'x' from information_schema.tables where table_name => 'mytable' and table_type = 'base table')
> create table mytable (id int identity(1,1), status varchar(20))
> if not exists (select 'x' from mytable)
> insert into mytable (status) select 'Not Active'
> Is this close?
> Also, do you not have foreign key constraints defined in your data model?
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:4F1222EF-14CF-49C4-B5E7-6F40E3CEE138@.microsoft.com...
> > Hi just wondering if there is a way to have a script that creates a table
> > write in a desired string for the first table entry?
> > I have an application that I am allowing the de-activation of a record. I
> > could not allow a delete since this could result in an orphan record. So
> > basically the table at startup (when first created) would look like
> > ****************************
> > * pri key * varchar (20)*
> > ****************************
> > * 1 * Not Active *
> > ****************************
> > the application would add records to the table as it is used.
> >
> >
> > --
> > Paul G
> > Software engineer.
>
>
Monday, March 12, 2012
FOR XML? UPDATED ANSWER (WAS: Newbie question...)
Apologies on the last post. I did not see FOR XML and was thinking of other
SQL capabilities.
FOR XML creates a valid XML snippet, without root tags. This gives you a
couple of choices.
1. Create templates that supply root tags
2. Supply root tags in your program
For XML input into SQL Server, you WILL end up with a blow up, as mentioned
in the prior response.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"VK" wrote:
> Hi,
> Will SQL XML (when we use FOR XML) perform check to make sure that XML
> document is in proper form or do we have to use a third party s/w like
> Altova to check for correctly created XML document?
> Many thanks for your time.
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
>
Let me clarify this a bit further.
FOR XML in most cases (except for invalid characters and when using the
xmltext directive in EXPLICIT mode) will generate well-formed fragments. You
can set a root property on your provider (ADO, ADO.net, or the HTTP ISAPI)
to have it wrapped.
When you use sp_xml_preparedocument to parse incoming XML data, you will get
an error message if the parsing fails. So it does not quite explode :-).
Best regards
Michael
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:B30C9949-8C15-46CE-826B-4961014B9B19@.microsoft.com...[vbcol=seagreen]
> Apologies on the last post. I did not see FOR XML and was thinking of
> other
> SQL capabilities.
> FOR XML creates a valid XML snippet, without root tags. This gives you a
> couple of choices.
> 1. Create templates that supply root tags
> 2. Supply root tags in your program
> For XML input into SQL Server, you WILL end up with a blow up, as
> mentioned
> in the prior response.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "VK" wrote:
SQL capabilities.
FOR XML creates a valid XML snippet, without root tags. This gives you a
couple of choices.
1. Create templates that supply root tags
2. Supply root tags in your program
For XML input into SQL Server, you WILL end up with a blow up, as mentioned
in the prior response.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"VK" wrote:
> Hi,
> Will SQL XML (when we use FOR XML) perform check to make sure that XML
> document is in proper form or do we have to use a third party s/w like
> Altova to check for correctly created XML document?
> Many thanks for your time.
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
>
Let me clarify this a bit further.
FOR XML in most cases (except for invalid characters and when using the
xmltext directive in EXPLICIT mode) will generate well-formed fragments. You
can set a root property on your provider (ADO, ADO.net, or the HTTP ISAPI)
to have it wrapped.
When you use sp_xml_preparedocument to parse incoming XML data, you will get
an error message if the parsing fails. So it does not quite explode :-).
Best regards
Michael
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:B30C9949-8C15-46CE-826B-4961014B9B19@.microsoft.com...[vbcol=seagreen]
> Apologies on the last post. I did not see FOR XML and was thinking of
> other
> SQL capabilities.
> FOR XML creates a valid XML snippet, without root tags. This gives you a
> couple of choices.
> 1. Create templates that supply root tags
> 2. Supply root tags in your program
> For XML input into SQL Server, you WILL end up with a blow up, as
> mentioned
> in the prior response.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "VK" wrote:
FOR XML? UPDATED ANSWER (WAS: Newbie question...)
Apologies on the last post. I did not see FOR XML and was thinking of other
SQL capabilities.
FOR XML creates a valid XML snippet, without root tags. This gives you a
couple of choices.
1. Create templates that supply root tags
2. Supply root tags in your program
For XML input into SQL Server, you WILL end up with a blow up, as mentioned
in the prior response.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"VK" wrote:
> Hi,
> Will SQL XML (when we use FOR XML) perform check to make sure that XML
> document is in proper form or do we have to use a third party s/w like
> Altova to check for correctly created XML document?
> Many thanks for your time.
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>Let me clarify this a bit further.
FOR XML in most cases (except for invalid characters and when using the
xmltext directive in EXPLICIT mode) will generate well-formed fragments. You
can set a root property on your provider (ADO, ADO.net, or the HTTP ISAPI)
to have it wrapped.
When you use sp_xml_preparedocument to parse incoming XML data, you will get
an error message if the parsing fails. So it does not quite explode :-).
Best regards
Michael
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:B30C9949-8C15-46CE-826B-4961014B9B19@.microsoft.com...
> Apologies on the last post. I did not see FOR XML and was thinking of
> other
> SQL capabilities.
> FOR XML creates a valid XML snippet, without root tags. This gives you a
> couple of choices.
> 1. Create templates that supply root tags
> 2. Supply root tags in your program
> For XML input into SQL Server, you WILL end up with a blow up, as
> mentioned
> in the prior response.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "VK" wrote:
>
SQL capabilities.
FOR XML creates a valid XML snippet, without root tags. This gives you a
couple of choices.
1. Create templates that supply root tags
2. Supply root tags in your program
For XML input into SQL Server, you WILL end up with a blow up, as mentioned
in the prior response.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"VK" wrote:
> Hi,
> Will SQL XML (when we use FOR XML) perform check to make sure that XML
> document is in proper form or do we have to use a third party s/w like
> Altova to check for correctly created XML document?
> Many thanks for your time.
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>Let me clarify this a bit further.
FOR XML in most cases (except for invalid characters and when using the
xmltext directive in EXPLICIT mode) will generate well-formed fragments. You
can set a root property on your provider (ADO, ADO.net, or the HTTP ISAPI)
to have it wrapped.
When you use sp_xml_preparedocument to parse incoming XML data, you will get
an error message if the parsing fails. So it does not quite explode :-).
Best regards
Michael
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:B30C9949-8C15-46CE-826B-4961014B9B19@.microsoft.com...
> Apologies on the last post. I did not see FOR XML and was thinking of
> other
> SQL capabilities.
> FOR XML creates a valid XML snippet, without root tags. This gives you a
> couple of choices.
> 1. Create templates that supply root tags
> 2. Supply root tags in your program
> For XML input into SQL Server, you WILL end up with a blow up, as
> mentioned
> in the prior response.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "VK" wrote:
>
Wednesday, March 7, 2012
FOR XML explicit
I have a need to output data from a simple database table to a XML file. The
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated..."NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated..."NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
FOR XML explicit
I have a need to output data from a simple database table to a XML file. The
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated...
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell
|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated...
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell
|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
FOR XML explicit
I have a need to output data from a simple database table to a XML file. The
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated..."NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
with a small amount of data. At approx 256 characters; the output is cutoff.
What is causing this and can it be corrected? I need to build an XML file
much larger. Should I be doing something different? I would like to have a
SQL solution as I want to set this process up as part of a SQL Job.
Any help would be appreciated..."NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
> I have a need to output data from a simple database table to a XML file.
The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
In Query Analyzer, go to Tools->Options
Click the Results tab and set your Maximum characters per column to 8000.
Rick Sawtell|||The problem is that you are just viewing the output in SQL Server Query
Analyzer and it doesn't show the results of FOR XML queries too well. You
can increase the SQL Server Query Analyzer column width as Rick pointed out,
but that will only help if the total amount of XML is less than 8000
characters, what you really need to do is write some code (in VB, or .NET,
or even just some script) to run the query and put the output into a file.
There is an example of some script that you can run in DTS here
http://www.sqlxml.org/faqs.aspx?faq=10
Sean
"NewtoSQLXML" <NewtoSQLXML@.discussions.microsoft.com> wrote in message
news:4C1E7788-396B-4F4E-9759-731ABA472F1F@.microsoft.com...
>I have a need to output data from a simple database table to a XML file.
>The
> FOR XML EXPLICITmode creates a 3 level xml output and seemed to work fine
> with a small amount of data. At approx 256 characters; the output is
> cutoff.
> What is causing this and can it be corrected? I need to build an XML file
> much larger. Should I be doing something different? I would like to have
> a
> SQL solution as I want to set this process up as part of a SQL Job.
> Any help would be appreciated...
Subscribe to:
Posts (Atom)