Two Basic Questions.

Hello, I am new to MS SQL 2K, migrating from MySQL.

First of all, this company I just started with has an MS SQL2K database 
sitting on a windows xp pro machine. We are moving it to MS Sever instead, 
don't know why it was on XP Pro - bad decision we think.

Second, in MS SQL we need to update a field during an insert event. So my 
two questions are:

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.
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.

Thanks, and if I'm not clear enough I certainly can provide more detail. 


0
Marian
3/1/2010 8:00:52 PM
sqlserver.server 1327 articles. 0 followers. Follow

13 Replies
559 Views

Similar Articles

[PageSpeed] 9

On Mon, 1 Mar 2010 13:00:52 -0700, "Marian Henna"
<marion.henna@yacobe.net> wrote:

>Hello, I am new to MS SQL 2K, migrating from MySQL.
>
>First of all, this company I just started with has an MS SQL2K database 
>sitting on a windows xp pro machine. We are moving it to MS Sever instead, 
>don't know why it was on XP Pro - bad decision we think.
>
>Second, in MS SQL we need to update a field during an insert event. So my 
>two questions are:
>
>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.
>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.
>
>Thanks, and if I'm not clear enough I certainly can provide more detail. 
>

Hi

I would not move to SQL 2000 as there is no mainstream support for it
see
http://blogs.msdn.com/sqlreleaseservices/archive/2008/02/15/end-of-mainstream-support-for-sql-server-2005-sp1-and-sql-server-2000-sp4.aspx

For moving the database look at
http://support.microsoft.com/kb/224071, make sure that you move
logins, jobs, packages etc as well.

If you look in Books online or at
http://msdn.microsoft.com/en-us/library/ms189799.aspx
you'll find the INSERTED and DELETED logical (conceptual) tables, so
you will need to add the sum of the products of Cost and Qry from the
INSERTED logical table to the current total and substract the sum of
the product from the DELETED logical table grouping by the key
columns. Post DDL and example data if you want an example.

John 


0
John
3/1/2010 9:44:51 PM
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;

-- 
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
0
Hugo
3/2/2010 12:28:38 AM
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.

So, for the short term we were thinking SQL2K now, then take a few courses, 
get the right SQL consultant to assist to make the best move in about 3 
months.

Thanks again for the information and links.

Also, the gear we have is not up to the SQL2K5/8 minimum requirements, so we 
will be investing in that as well.

"John Bell" <jbellnewsposts@hotmail.com> wrote in message 
news:drboo5521isarbvvf2adf6a14q953ib8q3@4ax.com...
> On Mon, 1 Mar 2010 13:00:52 -0700, "Marian Henna"
> <marion.henna@yacobe.net> wrote:
>
>>Hello, I am new to MS SQL 2K, migrating from MySQL.
>>
>>First of all, this company I just started with has an MS SQL2K database
>>sitting on a windows xp pro machine. We are moving it to MS Sever instead,
>>don't know why it was on XP Pro - bad decision we think.
>>
>>Second, in MS SQL we need to update a field during an insert event. So my
>>two questions are:
>>
>>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.
>>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.
>>
>>Thanks, and if I'm not clear enough I certainly can provide more detail.
>>
>
> Hi
>
> I would not move to SQL 2000 as there is no mainstream support for it
> see
> http://blogs.msdn.com/sqlreleaseservices/archive/2008/02/15/end-of-mainstream-support-for-sql-server-2005-sp1-and-sql-server-2000-sp4.aspx
>
> For moving the database look at
> http://support.microsoft.com/kb/224071, make sure that you move
> logins, jobs, packages etc as well.
>
> If you look in Books online or at
> http://msdn.microsoft.com/en-us/library/ms189799.aspx
> you'll find the INSERTED and DELETED logical (conceptual) tables, so
> you will need to add the sum of the products of Cost and Qry from the
> INSERTED logical table to the current total and substract the sum of
> the product from the DELETED logical table grouping by the key
> columns. Post DDL and example data if you want an example.
>
> John
>
> 


0
Marian
3/2/2010 3:36:07 AM
"Marian Henna" <marion.henna@yacobe.net> wrote in message 
news:OJqKpnXuKHA.5940@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


0
Maura
3/2/2010 4:32:51 AM
On Mon, 1 Mar 2010 22:32:51 -0600, "Maura Jenkins" <mj@nospam.com>
wrote:

>
>"Marian Henna" <marion.henna@yacobe.net> wrote in message 
>news:OJqKpnXuKHA.5940@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
>

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
0
John
3/2/2010 7:36:00 AM
On Mon, 1 Mar 2010 20:36:07 -0700, "Marian Henna"
<marion.henna@yacobe.net> 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.
>
>So, for the short term we were thinking SQL2K now, then take a few courses, 
>get the right SQL consultant to assist to make the best move in about 3 
>months.
>
>Thanks again for the information and links.
>
>Also, the gear we have is not up to the SQL2K5/8 minimum requirements, so we 
>will be investing in that as well.
>
>"John Bell" <jbellnewsposts@hotmail.com> wrote in message 
>news:drboo5521isarbvvf2adf6a14q953ib8q3@4ax.com...
>> On Mon, 1 Mar 2010 13:00:52 -0700, "Marian Henna"
>> <marion.henna@yacobe.net> wrote:
>>
>>>Hello, I am new to MS SQL 2K, migrating from MySQL.
>>>
>>>First of all, this company I just started with has an MS SQL2K database
>>>sitting on a windows xp pro machine. We are moving it to MS Sever instead,
>>>don't know why it was on XP Pro - bad decision we think.
>>>
>>>Second, in MS SQL we need to update a field during an insert event. So my
>>>two questions are:
>>>
>>>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.
>>>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.
>>>
>>>Thanks, and if I'm not clear enough I certainly can provide more detail.
>>>
>>
>> Hi
>>
>> I would not move to SQL 2000 as there is no mainstream support for it
>> see
>> http://blogs.msdn.com/sqlreleaseservices/archive/2008/02/15/end-of-mainstream-support-for-sql-server-2005-sp1-and-sql-server-2000-sp4.aspx
>>
>> For moving the database look at
>> http://support.microsoft.com/kb/224071, make sure that you move
>> logins, jobs, packages etc as well.
>>
>> If you look in Books online or at
>> http://msdn.microsoft.com/en-us/library/ms189799.aspx
>> you'll find the INSERTED and DELETED logical (conceptual) tables, so
>> you will need to add the sum of the products of Cost and Qry from the
>> INSERTED logical table to the current total and substract the sum of
>> the product from the DELETED logical table grouping by the key
>> columns. Post DDL and example data if you want an example.
>>
>> John
>>
>> 
I've assumed that the table to be updated is not the one where you
WO_Total is not the table that has WO_Item_Cost and  WO_Item_QTY.
If it is then use a calculated column as Hugo has said.

John
0
John
3/2/2010 7:37:45 AM
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....

A +
> 


-- 
Fr�d�ric BROUARD, MVP SQL Server, expert bases de donn�es et langage SQL
Le site sur le langage SQL et les SGBDR  :  http://sqlpro.developpez.com
Audit, conseil, expertise, formation, mod�lisation, tuning, optimisation
Enseignant aux Arts & M�tiers PACA et � L'ISEN Toulon - Var Technologies
*********************** http://www.sqlspot.com *************************
0
Fred
3/2/2010 4:40:49 PM
"John Bell" <jbellnewsposts@hotmail.com> wrote in message 
news:tmfpo5lqiuggi6396r8ltljjcg5rrbvjj7@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


0
Maura
3/3/2010 5:47:58 AM
Yes guys, the three columns are all in the same table. WO_Total only gets 
calculated once and that is during an insert. So would this still work, or 
would it recalculate for updates as well?

Thanks guys, I appreciate that these are pretty rookie questions, but we 
want to make sure it works as this will be pretty much that last change made 
before moving ahead.

Marion.
"John Bell" <jbellnewsposts@hotmail.com> wrote in message 
news:9vfpo59k9mbv7dgmmo1vom4ov4l58pgj3o@4ax.com...
> On Mon, 1 Mar 2010 20:36:07 -0700, "Marian Henna"
> <marion.henna@yacobe.net> 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.
>>
>>So, for the short term we were thinking SQL2K now, then take a few 
>>courses,
>>get the right SQL consultant to assist to make the best move in about 3
>>months.
>>
>>Thanks again for the information and links.
>>
>>Also, the gear we have is not up to the SQL2K5/8 minimum requirements, so 
>>we
>>will be investing in that as well.
>>
>>"John Bell" <jbellnewsposts@hotmail.com> wrote in message
>>news:drboo5521isarbvvf2adf6a14q953ib8q3@4ax.com...
>>> On Mon, 1 Mar 2010 13:00:52 -0700, "Marian Henna"
>>> <marion.henna@yacobe.net> wrote:
>>>
>>>>Hello, I am new to MS SQL 2K, migrating from MySQL.
>>>>
>>>>First of all, this company I just started with has an MS SQL2K database
>>>>sitting on a windows xp pro machine. We are moving it to MS Sever 
>>>>instead,
>>>>don't know why it was on XP Pro - bad decision we think.
>>>>
>>>>Second, in MS SQL we need to update a field during an insert event. So 
>>>>my
>>>>two questions are:
>>>>
>>>>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.
>>>>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.
>>>>
>>>>Thanks, and if I'm not clear enough I certainly can provide more detail.
>>>>
>>>
>>> Hi
>>>
>>> I would not move to SQL 2000 as there is no mainstream support for it
>>> see
>>> http://blogs.msdn.com/sqlreleaseservices/archive/2008/02/15/end-of-mainstream-support-for-sql-server-2005-sp1-and-sql-server-2000-sp4.aspx
>>>
>>> For moving the database look at
>>> http://support.microsoft.com/kb/224071, make sure that you move
>>> logins, jobs, packages etc as well.
>>>
>>> If you look in Books online or at
>>> http://msdn.microsoft.com/en-us/library/ms189799.aspx
>>> you'll find the INSERTED and DELETED logical (conceptual) tables, so
>>> you will need to add the sum of the products of Cost and Qry from the
>>> INSERTED logical table to the current total and substract the sum of
>>> the product from the DELETED logical table grouping by the key
>>> columns. Post DDL and example data if you want an example.
>>>
>>> John
>>>
>>>
> I've assumed that the table to be updated is not the one where you
> WO_Total is not the table that has WO_Item_Cost and  WO_Item_QTY.
> If it is then use a calculated column as Hugo has said.
>
> John 


0
Marian
3/3/2010 12:55:30 PM
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@nospam.com> wrote in message 
news:%23VU2vFcuKHA.800@TK2MSFTNGP04.phx.gbl...
>
> "Marian Henna" <marion.henna@yacobe.net> wrote in message 
> news:OJqKpnXuKHA.5940@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
>
> 


0
Marian
3/3/2010 12:57:55 PM
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@nospam.com> wrote in message 
news:uNI7YUpuKHA.2436@TK2MSFTNGP04.phx.gbl...
>
> "John Bell" <jbellnewsposts@hotmail.com> wrote in message 
> news:tmfpo5lqiuggi6396r8ltljjcg5rrbvjj7@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
>
> 


0
Marian
3/3/2010 1:00:57 PM
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
0
Hugo
3/5/2010 10:56:41 PM
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
0
Hugo
3/5/2010 10:57:40 PM
Reply:

Similar Artilces:

QUESTION ABOUT DISABLING A BUTTON ON A FORM
I have 2 checkbox on a form and a button. The button is disabled when the form is loaded and enabled when either of the checkboxes is checked. What I want to do is set things up such that when the checkboxes are both unchecked, the button is disabled. I tried the On Current event of the form, see below, but that didn't work. Any ideas? Thanks Private Sub Form_Current() If Me.chkFilterBy.Value = False And Me.chkTimeRange.Value = False Then Me.cmdFilter.Enabled = True Else Me.cmdFilter.Enabled = False End If End Sub Private Sub Form_Load() M...

Excel : Saving and Mailing Question
Hi, A few questions I hope you can help me with (please) : 1. Is it possible to save a particular worksheet under a set name t one destination and the rest of the workbook to another, through macro/click of a button? 2. Is it possible to do the same but through email? Thanks Andre -- Message posted from http://www.ExcelForum.com Ron de Bruin has lots of code examples at: http://www.rondebruin.nl/sendmail.htm He also has an addin that may do almost what you want. (on that same web page) "ajw150 <" wrote: > > Hi, > > A few questions I hope you can help me wi...

synchiing two computers?
Is there a way to synch Outlook on two computers? I end up with some email on my laptop and some on my desktop - it would be nice if the two could be synched so that I could have all of my email on both computers. Take a look here, it may help: http://www.slipstick.com/outlook/sync.htm -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, Bill Andersen asked: | Is there a way to synch Outlook on two computers? | I end up with some...

EN_UPDATE usability question
What would a reasonable upper limit in time spent responding to the EN_UPDATE notification? If its too long the UI would be lagged and that would be an annoyance to the end user. Is this in any official MS style guide? Personally I would assume maybe .25 seconds however this is for an official document so I need to be able to back up a value with some officialness such as MS recommendation. River, You might want to do a Google search, this is a well-researched topic, and I imagine you'll find quite a few studies. For web usability, there has been lots of work, at least, and as...

modification questions
Does anyone know for sure if setting up modifications in the isv.config and web.config files before migrating data from siebel into crm will cause any problems? Every time I talk to someone at Microsoft they ask me if I've done any modifications....I need to make some modifications when I go live before I run the migration scripts. I just don't want it to cause any problems. Thanks, Jen Hi. I can't think of any reason why modifying these files would impact on data migration but logically I would have thought you would want to migrate the data first and then make the cha...

Compare two cells in two different files and return answer
I am attempting to compare two text cells and if they both exist, I want to bring in a "yes" answer. If they don't, bring in a "no" answer. Here's an example of text. File 1 Col A Col B BRATTA ZPB_COMMON AHERNC ZPB_COMMON GENCABH ZPB_COMMON File 2 Col A Col B BRATTA ZPB_COMMON AHERNC ZPB_COMMON GENCABH So, what I want to do is say in File 1 take cells A1 and B1 compare them to File 2 and search Col A and Col B and if there is an exact mat...

Exmerge Question #5
Two scenarios: 1. Seems like this should work no problem. If a user mailbox was deleted using Exchange Tasks (but not the user) and I was able to restore the mail store to a RSG, shouldn't I use Exmerge to pull the data out of the RSG and put it all back into the original account (of course assuming that I've created an empty mailbox for the user)? It seems for whatever reason Exmerge isn't able to see the database after the mailbox has been removed and a new one created on the account. 2. Should the above situation work if it's a whole new user created where the o...

Pivot table for two different data variables
I have the following table Name type Cost overhead amy C1 23 12 bob C2 129 17 cat C2 36 45 doo C2 100 32 I owuld like to create a pivot table that looks similar to: the standard pivot table. (Please ignore type for now.) name Data Total amy Sum of overhead 200 Sum of cost 12 bob Sum of overhead 130 Sum of cost 23 cat Sum of overhead 90 Sum of cost 19 doo Sum of overhead 87 Sum of cost 34 Total Sum of overhead 507 Total Sum of cost 88 But with overall total (overhead + cost) for ...

Mouse event question
Does anybody know if is there an event triggered in the CWnd class when a mouse "enters" that class, I mean, for example, when the mouse moves out from a view, or returns to a mainframe from the desktop? So far, the only workaround I've found is to use the OnSetCursor event to signal the position of the mouse, but this is not the optimal, since is triggered each time the mouse moves, making the application slow, and, as I said, I only need a signal that tells me when the mouse leaves one window and enter to another. Thanks a lot for your attention. OnMouseMove is what you nee...

if- then question
Is it possible to compare two rows and then based on the value, assign a character to occupy and adjacent column in the same row. For example, I want to compare all of the numbers in column B, with th numbers in column D, if B is greater than D, I want to put the lette "W" in the adjacent column (in the same row). If B is less than D, want to put the letter "L" in the adjacent column. Is this possible -- Message posted from http://www.ExcelForum.com Hi enter the following in the adjacent row (lets say in column E, cell E1) =IF(B1>D1,"W",IF(B1<D1,"...

Few questions about VB
1. How can I do number for example 812 from 812,033217 ? I try to do like this but it did not work Dim first as double Dim second as intiger firs = 812,033217 second = first first = second but still firs = 812,033217 :confused: 2. How can I open not .xls file from VB code wrote in Excel file I want to open Solid Works file "example.SLDPRT" in Solid Works o course thx for any suggestio -- Message posted from http://www.ExcelForum.com Hi 1. one way: use CInt. e.g. second = CInt(first) >-----Original Message----- >1. How can I do number for example 812 from 812,03321...

Two IF Statements with two answers
In cell J9 I need a formula that would do the following: If G9="Yes" then F9, If G9="No" then -f9 Note: G9 has a drop down list with Yes, No answers. If there are no other alternatives that yes and no =IF(G9="Yes",F9,-F9) otherwise =IF(G9="Yes",F9,IF(G9="No",-F9,"") Regards, Peo Sjoblom "heater" wrote: > In cell J9 I need a formula that would do the following: > > If G9="Yes" then F9, If G9="No" then -f9 > > Note: G9 has a drop down list with Yes, No answers. > =IF(G9=&qu...

A question for the guro
How do I select a node that has both namespace and is prefixed? IE: <a:b> (and also in the default namespace!) Ayende Rahien wrote: > How do I select a node that has both namespace and is prefixed? > IE: > <a:b> (and also in the default namespace!) How exactly depends on the API you are using, but in general such selection requires additional information about which namespcae URI "a" prefix is bound to. In MSXML it's done via SelectionNamespaces property, in .NET - via XmlNamespaceManager class. -- Oleg Tkachenko XML Insider http://www.tkachenko.com/...

question about CStringT::Tokenize
Hi, I try to split a string "First,,Third" with ",". I suppose the result is "First", "", and "Third". But why it is "First","Third".(A empty string has been skipped.) BTW, how about ",First,Second,Third" and "First,Second,Third," If CString::Tokenize cannot support it directly, any other way can do it easily. //code CString str( "First,,Third" ); CString resToken; int curPos= 0; CString strSplitter( "," ); resToken= str.Tokenize(strSplitter,curPos); while (resToken != &...

5.5 to 2003 migration question
I currently have Win2003 Active Directory in a single domain running. Exchange 5.5 on a Windows NT box is the last remaining WinNT box on the network. If I put a test Win2003 server and do all the forestpreps, domainpreps and run the ADC and install a test copy of Exchange 2003 and I use one test mailbox on the 5.5 to move it, will this prevent me from moving the rest of the mailboxes and database to another Exchange setup that will be permanent later? Um...it depends by what you mean when you say 'another Exchange setup'. You should approach the Forest prep and domain prep...

access 97/2000 question
If an access 97 back end database containing only tables is accessed by an access 2000 front end, is there a danger or possibility that the tables will be no longer accessable by access 97 front ends? Hi Alan, If the 2000 front end just contains linked tables pointing to the 97 back end, no worries. But if someone using 2000 opens and converts the back end mdb itself, you're obviously hosed. On Wed, 25 Feb 2004 20:11:00 -1000, "Alan" <please@thanks.com> wrote: >If an access 97 back end database containing only tables is accessed by an >access 2000 front end, is...

COUNTIF (?) on two criteria
I have a spreadsheet that logs work activities and records team members' completion of project units. Column B records team member names. Column C has project unit status - 'pending', 'beta' or 'completed'. It's easy to set up a formula to count how many units are allocated to each team member - =COUNTIF(B1:B1000,"Joe"). But what I need to do is set up formulas to count how many units Joe has completed, or has pending or at beta, and this means assessing data in both columns - which COUNTIF won't do. This doesn't strike me as an especially...

viewing questions
Is there a way to sort the questions by date. I cannot figure out how the questions are ordered. It's not by date, it's not by alpha, it's not by popular - there appears to be no rhyme or reason to it. If you access the forum directly from the server http://www.gmayor.com/MSNews.htm you can sort them in any way you like. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< >...

A CString question
Hi to all, Given the following member function: CString MyClass::MakeString(BYTE *pBuf, int len) { CString str; ... return str; } Where: - 'pBuf' is a buffer that contains letters (a-z). It does not contain a terminating null character. - 'len' is the number of letters in 'pBuf'. What would be the best way to return a CString object that contains the same letters in 'pBuf'. I appreciate any suggestions. Thanks, Geo You can create a new CString using the constructor with CString(pointer,len) so why not just do: CString str(pBuf,len); You ...

Two axis
Positioning the Vertical axes: I have a chart where there are two axes. The first implementation produced the two scales on the right side, one inside, the other outside the chart area. Unusual, but luckily it fits well the chart. I tried to duplicate the feat with another dataset (similar in structure) and did not even get the second scale to show right, left or center (data plotted with two different scales allright). Where is the info to control these functionalities? Tx, Pierre On Wed, 29 Oct 2003 17:48:13 +0100, pl.carry <pl.carry@wanadoo.fr> wrote= : > Positioning the Vertic...

TreeView XML Question
Hi Guys, I have different pages in ASP.NET.And i have a treeview that populates XML that i use as the MENU. Is it possible to have one asp.net page but populating different XML to the mENU? Any ideas? ...

plot two groups of numbers on one series of xy coordinates.
how to create a plot from separate x and y values. i.e. y values do not correspond to the same set of x values. example x1= 5, y1=10; x2= 8, y2=15 I can read your question 2 ways; A) you data looks like this x y 5 10 8 15 etc. Select the data and make an XY chart B) you have two sets of data x1 y1 5 10 10 12 17 15 21 20 and x2 y2 3 8 7 14 12 19 18 24 Make an XY chart of the first data series Select all the data (including headers) for second set, and use Copy Click the chart to activate it Use Edit | Paste Special .... indicate New Ser...

two variables
I have a query that asks for collcode, collcode2 and booth. On any given day an employee may be collcode or collcode2. I would like to know how many times a certain emp has been paired with another employee. So how do I ask if an employee has been collcode/collcode2 and who the other person was? I hope this question makes sense. Thanks for any help Query one: SELECT CollCode, CollCode2, Booth FROM YourTable UNION ALL SELECT CollCode2, CollCode, Booth FROM YourTable Query Two SELECT CollCode, CollCode2, Count(CollCode) AS TIMESPAIRED FROM QueryOne GROUP BY CollCode, CollCode2 IF y...

Find two PCI instance but load Init() one time
Hi all, I'm developing a stream interface driver for my PCI device under WinCE 6.0 and this driver works very well currently. Now, I got a problem when testing two the same PCI devices with my stream driver. The registry can find two PCI instances (i.e. PCI\Instance\mydrv1, PCI\ Instance\mydrv2) but system only call my XXX_init() one time. Does anyone know what the problem is? The following information is my registry setting: ================================================================== [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\PCI\Template\mydrv] "Dll"="myd...

Copy selected columns from .xls to a .txt file question
I would like to be able to copy two columns from a .xls file, columns 2 (B) and 9(I) into a .txt file for approximately 100 rows, using VBA. What is the best way to do this? Thank you try this Sub Copy_Rows() With Application .DisplayAlerts =3D False .ScreenUpdating =3D False End With FpatH =3D "C:\Documents and Settings\username\filename.xls" Workbooks.Open FpatH FileP =3D ActiveWorkbook.path Range("B1:C100").Copy Workbooks.Add ActiveSheet.Paste ActiveWorkbook.SaveAs Filename:=3D _ FileP & "\" & "1.txt&...