Showing posts with label query. Show all posts
Showing posts with label query. Show all posts

Wednesday, March 28, 2012

import into more than 1 table

Hi everyone,
im trying to import data using a query...how ever i can only insert data into one table, and i need to insert data into many...this is at the part where you map the fields...
is there a way to do this? or something similar?
Thanks, Justinyou could export your data to a flat file using bcp, then import that file to as many destinations as you like, again using bcp.|||you could export your data to a flat file using bcp, then import that file to as many destinations as you like, again using bcp.

hi, and thanks for your reply...

but im not sure what bcp is?

Thanks, Justin|||Open up Books Online (or press F1 from the Query Analyzer screen) ... click on the INDEX tab ... type bcp ... peruse the various topics ... click on bcp utility for the syntax ... give it a try.

Sunday, February 19, 2012

Implicit transaction

Can Implicit Transactions be set for the Data Base and not for every query in
SQL Server? For a Data Base, how do we set that and how do we verify the
existing setting .
Ven
There is not databse option for this, but you do not have to set it for every
statement, you set it for the connection and it remains in effect until the
connection executes a SET IMPLICIT_TRANSACTIONS OFF statement.
AMB
"Ven" wrote:

> Can Implicit Transactions be set for the Data Base and not for every query in
> SQL Server? For a Data Base, how do we set that and how do we verify the
> existing setting .
> --
> Ven
|||Be wary of using this option, your program will remain in transaction state
almost all of the time..
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Ven" <Ven@.discussions.microsoft.com> wrote in message
news:7B4AB9B4-8003-4122-AD69-0695985785A7@.microsoft.com...
> Can Implicit Transactions be set for the Data Base and not for every query
in
> SQL Server? For a Data Base, how do we set that and how do we verify the
> existing setting .
> --
> Ven

Implicit transaction

Can Implicit Transactions be set for the Data Base and not for every query i
n
SQL Server? For a Data Base, how do we set that and how do we verify the
existing setting .
--
VenThere is not databse option for this, but you do not have to set it for ever
y
statement, you set it for the connection and it remains in effect until the
connection executes a SET IMPLICIT_TRANSACTIONS OFF statement.
AMB
"Ven" wrote:

> Can Implicit Transactions be set for the Data Base and not for every query
in
> SQL Server? For a Data Base, how do we set that and how do we verify the
> existing setting .
> --
> Ven|||Be wary of using this option, your program will remain in transaction state
almost all of the time..
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Ven" <Ven@.discussions.microsoft.com> wrote in message
news:7B4AB9B4-8003-4122-AD69-0695985785A7@.microsoft.com...
> Can Implicit Transactions be set for the Data Base and not for every query
in
> SQL Server? For a Data Base, how do we set that and how do we verify the
> existing setting .
> --
> Ven

Implicit Conversion in Query Analyzer

I am trying to construct a query in Query Analyzer (with SQL Server 2000), but am getting an error regarding "implicit conversion."

Here is the query:

SELECT dbo.AUCTION.EbayNum, dbo.AUCTION.EndDate,
DATENAME([month], dbo.AUCTION.EndDate) + ' ' + DATENAME([year], dbo.AUCTION.EndDate) AS [PmtMonth],
dbo.LOT.Description, dbo.AUCTION.WinBid,
PaidStat = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''
ELSE 'PAID'
END,
PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''
ELSE dbo.AUCTION.WinBid
END
FROM dbo.AUCTION INNER JOIN
dbo.LOT ON dbo.AUCTION.LotNum = dbo.LOT.LotNum
WHERE (LEN(dbo.AUCTION.Winner) > 0)

The error occurs in the PaidAmt CASE statment:
"Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query."

Why is there an implicit conversion going on? And how can I fix it? :mad:Maybe here:?

PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''

You are trying to insert a zero-length string into the PaidAmt column (presumably money datatype).

Try this instead:

PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN NULL|||Woo hoo! Thanks -- I forgot to try that. :)