Re: Simple Best Practice Question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Marek (Marek_at_discussions.microsoft.com)
Date: 10/19/04


Date: Tue, 19 Oct 2004 12:25:04 -0700

Thanks for that. Clears things up a little. Think I will buy that book you
recommend. The only thing I am unsure of is how I update only the fields
that have changed value? Or, do I just update the entire record with all the
values on the form irrespective of whether they have been changed.

"Arnie Rowland" wrote:

> No, the code doesn't determine which column to update -YOU have to make that
> determination.
>
> When you call the sproc, pass in the variables (parameters) from the screen
> forms (textbox values, etc.) In the stored procedure assign a parameter to
> receive each variable passed, and then SET the appropriate column =
> parameter .
>
> Working with what Uri provided you,
>
> CREATE PROC MyProc
> ( --This is the input paramter list
> @PKValue datatype
> , @Param1 datatype
> , @Param2 datatype
> , @Param3 datatype
> [, etc.]
> )
> AS
> UPDATE MyTable
> SET --This is where you assign input parameter values to columns
> Column1 = Param1
> , Column2 = Param2
> , Column3 = Param3
> [, etc]
> WHERE --Use the Primary Key Value to update the correct row in the table
> PKColumn = @PKValue
>
>
>
>
> I recommend the following book:
>
> Beginning SQL Programming (Programmer to Programmer), John Kauffman, Brian
> Matsik, Kevin Spencer, Ian Herbert, Sakhr Youness, Julian Skinner, ISBN:
> 1861001800
> The book gives step-by-step instructions, alerts readers to common pitfalls,
> tricks and traps, and uses real-world examples, including two extensive case
> studies, to create a thorough tutorial. It will furnish readers with a firm
> grasp of SQL concepts that you can work with straight away, as well as
> provide solid foundations and challenging ideas with which you can later
> develop more advanced SQL techniques.
>
>
>
>



Relevant Pages

  • Re: mySQL Problem
    ... sql servers) specify precisely where the problem is - this time it ... queries code readability you are, of course, right, since a programmer ... are things called RESERVED WORDS. ... about formatting. ...
    (comp.lang.php)
  • Re: mySQL Problem
    ... sql servers) specify precisely where the problem is - this time it ... As for rude yelling about making mistakes with reserved words, ... about formatting. ... It is not "correct" by virtually any programmer I know. ...
    (comp.lang.php)
  • Re: Convert bit feld to Yes/No
    ... Your whole model of SQL and RDBMS is totally wrong. ... physical implementation you can get. ... no good programmer would ever write non-portable code by getting ... then come in and charge their employer ...
    (microsoft.public.sqlserver.programming)
  • Re: Pass Table as a parameter to a function
    ... Gee, I looked all over my SQL Standards and books, but could not find ... some additional tier in between Reporting Services and the database; ... especially when such a tier is not needed. ... there is nothing wrong with being an application programmer. ...
    (comp.databases.ms-sqlserver)
  • Re: Bitwise OR just like SUM or COUNT
    ... It is programmers like you that make machines use more memory ... > a bad programmer?? ... > a high level language like SQL. ... SQL is a high level language; ...
    (microsoft.public.sqlserver.programming)