From: Marian Henna on
Oh boy, I was somewhat afraid that someone would be unclear. I think (after
re reviewing the BOL), the actual term is Detach (not drop), sorry about
that. So my understanding is to Script the DB (ie: Script), then detach, run
the script on the Server, and attach.

Does this help???
"Maura Jenkins" <mj(a)nospam.com> wrote in message
news:%23VU2vFcuKHA.800(a)TK2MSFTNGP04.phx.gbl...
>
> "Marian Henna" <marion.henna(a)yacobe.net> wrote in message
> news:OJqKpnXuKHA.5940(a)TK2MSFTNGP02.phx.gbl...
>
>> 1) If we run the script to create the DB on the Server, can we drop the
>> DB and load the original DB from the XP machine? I think this is the
>> correct terminology.
>
> this is not too clear; drop what DB and run what script? what you should
> be able to do is detach the DB on the XP machine, copy it to the second
> machine and then attach it there ... haven't done one in a while so I'm
> short on details here ... point is that it's not too difficult .. but
> there are some potential gotchas if your FROM and TO server configurations
> vary from one another
>
>> 2) We have a column in a table that we need to update via a calculation
>> of two fields. So we need to do something like this:
>>
>> --->>> WO_Total = WO_Item_Cost * WO_Item_QTY.
>
> assume you have an identity column "id" as your primary key; your trigger
> can be this simple:
>
>
>
> CREATE TRIGGER calc
>
> ON yourTable
>
> FOR INSERT
>
> AS
>
>
>
> UPDATE yourTable SET WO_Total = WO_Item_Cost * WO_Item_QTY
>
> WHERE id = @@IDENTITY
>
>
>
> you don't have to have an IDENTITY column; but you will need some
> predicate for the WHERE that updates the current row only
>
>
>
> another example for WHERE:
>
> WHERE emp_id = inserted.emp_id
>
>


From: Marian Henna on
Thanks again Maura and John. Actually John did bring up a good point, there
is a real probability that many rows could be added at the same moment.

As for "floundering", I'm not sure that would be the correct term. I think
the term would be "consciences and investigative" before moving on and
making the same basic mistakes that are already evident.

Thanks.
"Maura Jenkins" <mj(a)nospam.com> wrote in message
news:uNI7YUpuKHA.2436(a)TK2MSFTNGP04.phx.gbl...
>
> "John Bell" <jbellnewsposts(a)hotmail.com> wrote in message
> news:tmfpo5lqiuggi6396r8ltljjcg5rrbvjj7(a)4ax.com...
>
>> Your trigger assumes that a single row has been inserted if you use
>> @@IDENTITY and even if your application only inserts a single row it
>> will cause problems when you have to do things en-mass such as
>> releases or if your application changes. Therefore you should never
>> assume that more than one row will never be inserted/updated/deleted..
>>
>> John
>
> my reply was, pretty clearly, a very basic suggestion to someone who
> appeared to be floundering in search of some basic information; it's a way
> to get started, not a final solution covering all contingencies; my
> experience is that people having difficulty with a new technology are well
> served by getting a simple "win" under their belt by making something
> work, no matter how simple ... it helps them get to the next step and
> pursue the more nuanced and complex issues; if you throw all of the ifs,
> ands, and buts at someone at an early stage, they have a tendency to get
> overwhelmed and throw their hands up in the air ...
>
> Maura
>
>


From: Hugo Kornelis on
On Mon, 1 Mar 2010 20:36:07 -0700, Marian Henna wrote:

>Thank you John.
>
>The reason is that my company owns SQL 2000 so we want to do this enterimly.
>We are going to be evaluating SQL2K5 and SQL2K8. We obviously want to make
>the right decision as we are having some serious drawbacks with MySQL.

Have you also considered using SQL 2008 Express? It's basically the same
product as other editions of SQL Server, but with a few limitations
(does not use multiple processors or more than 1GB of RAM and caps the
database at a maximum size of 4GB; lacks some of the more enterprisey
features) and a much lower price - free!

http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
From: Hugo Kornelis on
On Tue, 02 Mar 2010 17:40:49 +0100, Fred BROUARD wrote:

>Hugo Kornelis a �crit :
>> On Mon, 1 Mar 2010 13:00:52 -0700, Marian Henna wrote:
>>
>>> 2) We have a column in a table that we need to update via a calculation of
>>> two fields. So we need to do something like this:
>>>
>>> --->>> WO_Total = WO_Item_Cost * WO_Item_QTY.
>>>
>>> Not sure how to put this in to a trigger. We do this fine in MySQL, but
>>> can't seem to figure out how to make this trigger.
>>
>> Hi Marian,
>>
>> No need for a trigger, just create a computed column in the table:
>>
>> CREATE TABLE Demo
>> (PrimKey int NOT NULL PRIMARY KEY,
>> Col1 int NOT NULL,
>> Col2 int NOT NULL,
>> Col3 AS Col1 * Col2);
>> INSERT INTO Demo (PrimKey, Col1, Col2)
>> VALUES (1, 2, 3);
>> SELECT PrimKey, Col1, Col2, Col3 FROM Demo;
>> DROP TABLE Demo;
>
>And best will be with a PERSISTED calcuted column....

That depends. If it has to be indexed, or if the computation is very
complex and time-consuming, then yes. Otherwise, mostly not.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis