Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Tuesday, March 27, 2012

Can we do the Validations in bcp format file

Hi
I need few clarifications. I am using bcp 9.0 tool to load the data into the
table in SQL Server 2005.
Can we do validations in bcp format file.
The validations like
1. if the datafile field data is "ABC" I want to insert the data into table
as "DEF" or if the datafile field data is "123" I want to insert the data
into table as "456" .
2. Format the date filed and insert the formated date data into table column
.
3. Assign default values or Constant values for the columns of the table,
the data for those fields are not exist in the date file
Thanks in Advance
Regards
VeeruVeeru (Veeru@.discussions.microsoft.com) writes:
> I need few clarifications. I am using bcp 9.0 tool to load the data into
> the table in SQL Server 2005.
> Can we do validations in bcp format file.
> The validations like
> 1. if the datafile field data is "ABC" I want to insert the data into
> table as "DEF" or if the datafile field data is "123" I want to insert
> the data into table as "456" .
> 2. Format the date filed and insert the formated date data into table
> column.
> 3. Assign default values or Constant values for the columns of the table,
> the data for those fields are not exist in the date file
I've answered this question in .tools. Please don't post the same question
independently to multiple newsgroups.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Sunday, March 11, 2012

Can the "money" datatype be constrained to two decimal places?

I have a column that is a "money" datatype, which returns a four decimal
place value. It is a bit of a hassle to format this for display. Is there
anyway to default this to two decimal places?No, the datatype cannot be changed.
Look at CAST and CONVERT and you will see that there is a style that you can
use with CONVERT to return the value with 2 decimal places. (Or you could
stop using money and use DECIMAL if that meets your need.)
Russell Fields
"Top Gun" <nfr@.nospam.com> wrote in message
news:OyqMHnk8DHA.2540@.TK2MSFTNGP11.phx.gbl...
> I have a column that is a "money" datatype, which returns a four decimal
> place value. It is a bit of a hassle to format this for display. Is there
> anyway to default this to two decimal places?
>|||No, change to decimal as Russell suggests... But the benefit of using money
is that the front-end application should be able to recognize and format the
data to 2 decimals using localization... Many folks need the 4 decimals for
increased accuracy, then round for display...
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"Top Gun" <nfr@.nospam.com> wrote in message
news:OyqMHnk8DHA.2540@.TK2MSFTNGP11.phx.gbl...
> I have a column that is a "money" datatype, which returns a four decimal
> place value. It is a bit of a hassle to format this for display. Is there
> anyway to default this to two decimal places?
>

Can the "money" datatype be constrained to two decimal places?

I have a column that is a "money" datatype, which returns a four decimal
place value. It is a bit of a hassle to format this for display. Is there
anyway to default this to two decimal places?No, the datatype cannot be changed.
Look at CAST and CONVERT and you will see that there is a style that you can
use with CONVERT to return the value with 2 decimal places. (Or you could
stop using money and use DECIMAL if that meets your need.)
Russell Fields
"Top Gun" <nfr@.nospam.com> wrote in message
news:OyqMHnk8DHA.2540@.TK2MSFTNGP11.phx.gbl...
> I have a column that is a "money" datatype, which returns a four decimal
> place value. It is a bit of a hassle to format this for display. Is there
> anyway to default this to two decimal places?
>|||No, change to decimal as Russell suggests... But the benefit of using money
is that the front-end application should be able to recognize and format the
data to 2 decimals using localization... Many folks need the 4 decimals for
increased accuracy, then round for display...
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"Top Gun" <nfr@.nospam.com> wrote in message
news:OyqMHnk8DHA.2540@.TK2MSFTNGP11.phx.gbl...
> I have a column that is a "money" datatype, which returns a four decimal
> place value. It is a bit of a hassle to format this for display. Is there
> anyway to default this to two decimal places?
>

Can tags be duplicated?

My xml file has the tags in the below format.
say :
<country>
<city>
<st>
<no>5</no>
</st>
</city>
<village>
<st>
<no>4</no>
</st>
</village>
</country>
Can the tag <st> be present within 2 different parents?
If yes, how do I differentiate <st> in each case?
Regards
MeenakshiMeenakshi wrote:

> Can the tag <st> be present within 2 different parents?
Yes, of course.

> If yes, how do I differentiate <st> in each case?
Do you want to write a schema for that XML? Or do you want to query the XML?
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/|||I need to write a scema for that XML.
How do I do that?
Regards
Meena
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:OM5sj5JwHHA.4528@.TK2MSFTNGP03.phx.gbl...
> Meenakshi wrote:
>
> Yes, of course.
>
> Do you want to write a schema for that XML? Or do you want to query the
> XML?
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/|||Meenakshi wrote:
> I need to write a scema for that XML.
> How do I do that?
Here is an example schema that inlines the element definitions:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="city">
<xs:complexType>
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="village">
<xs:complexType>
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Another solution would be to define a complexType and reference that as
follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:complexType name="typeName">
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="city" type="typeName"></xs:element>
<xs:element name="village" type="typeName"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/|||Thank You
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:%23fG8lyhwHHA.1212@.TK2MSFTNGP05.phx.gbl...
> Meenakshi wrote:
> Here is an example schema that inlines the element definitions:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xs:element name="country">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="city">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="village">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Another solution would be to define a complexType and reference that as
> follows:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xs:complexType name="typeName">
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="country">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="city" type="typeName"></xs:element>
> <xs:element name="village" type="typeName"></xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/

Can tags be duplicated?

My xml file has the tags in the below format.
say :
<country>
<city>
<st>
<no>5</no>
</st>
</city>
<village>
<st>
<no>4</no>
</st>
</village>
</country>
Can the tag <st> be present within 2 different parents?
If yes, how do I differentiate <st> in each case?
Regards
Meenakshi
Meenakshi wrote:

> Can the tag <st> be present within 2 different parents?
Yes, of course.

> If yes, how do I differentiate <st> in each case?
Do you want to write a schema for that XML? Or do you want to query the XML?
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
|||I need to write a scema for that XML.
How do I do that?
Regards
Meena
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:OM5sj5JwHHA.4528@.TK2MSFTNGP03.phx.gbl...
> Meenakshi wrote:
>
> Yes, of course.
>
> Do you want to write a schema for that XML? Or do you want to query the
> XML?
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/
|||Meenakshi wrote:
> I need to write a scema for that XML.
> How do I do that?
Here is an example schema that inlines the element definitions:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="city">
<xs:complexType>
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="village">
<xs:complexType>
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Another solution would be to define a complexType and reference that as
follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:complexType name="typeName">
<xs:sequence>
<xs:element name="st">
<xs:complexType>
<xs:sequence>
<xs:element name="no" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="city" type="typeName"></xs:element>
<xs:element name="village" type="typeName"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
|||Thank You
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:%23fG8lyhwHHA.1212@.TK2MSFTNGP05.phx.gbl...
> Meenakshi wrote:
> Here is an example schema that inlines the element definitions:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xs:element name="country">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="city">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="village">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Another solution would be to define a complexType and reference that as
> follows:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
> <xs:complexType name="typeName">
> <xs:sequence>
> <xs:element name="st">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="no" type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="country">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="city" type="typeName"></xs:element>
> <xs:element name="village" type="typeName"></xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/

Sunday, February 19, 2012

Can service broker process a email message

How do you set up the service broker to process an email message, and how do you format that message and send it to the que.

Can the service broker alos process an html form from a que.

Thanks

Service Broker can only be used for exchanging messages between two SQL Instances. You cannot send nor receive email messages directly to/from Service Broker.

Why do you need to send email messages to a queue?

HTH,
~ Remus

Can RS export word document?

I saw on the report server web page, the word format is not supported for exporting. Is there any way to export report to a word editable document.

Hello,

There are many posts about this in this forum, but a Word export isn't supplied by Microsoft. You will have to write your own or purchase a 3rd party tool. Take a look here, a couple 3rd party tools are mentioned.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=946719&SiteID=1

Jarret

Can ReportViewer save report to another format?

Now Report Viewer can save report to xml and pdf format.

Can it save report to another format? e.g word, text

This depends on availability of renderers.
Currently no, in future versions - yes, likely

|||

yes it's possible, however you have to write your own report renderer. Please read this link http://msdn.microsoft.com/msdnmag/issues/05/02/CustomRenderers/ for more info.