Showing posts with label insertion. Show all posts
Showing posts with label insertion. Show all posts

Sunday, February 19, 2012

Data insertion using stored procedure.

Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
following field insertion into a table, just wondering what statements to use.
table name = tabletest
*****************************
* primary key * varchar * integer *
*****************************
* 1 * test * 34 *
*****************************
* 2 * test2 * 21 *
*****************************
The input to the procedure is a 2, and I want the procedure to replace
the 21 with another integer (say 5) while leaving the rest of the row
unchanged, still contains string test2 and primary key 2.
Thanks.
Paul G
Software engineer.
Read about the UPDATE command. An example (no column names were given...):
CREARE PROC procname
@.col1 int
AS
UPDATE tabletest
SET col3 = 5
WHERE col1 = @.col1
GO
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
> Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
> following field insertion into a table, just wondering what statements to use.
> table name = tabletest
> *****************************
> * primary key * varchar * integer *
> *****************************
> * 1 * test * 34 *
> *****************************
> * 2 * test2 * 21 *
> *****************************
> The input to the procedure is a 2, and I want the procedure to replace
> the 21 with another integer (say 5) while leaving the rest of the row
> unchanged, still contains string test2 and primary key 2.
> Thanks.
>
> --
> Paul G
> Software engineer.
|||ok, thanks for the information.
"Tibor Karaszi" wrote:

> Read about the UPDATE command. An example (no column names were given...):
> CREARE PROC procname
> @.col1 int
> AS
> UPDATE tabletest
> SET col3 = 5
> WHERE col1 = @.col1
> GO
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
>
>

Data insertion using stored procedure.

Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
following field insertion into a table, just wondering what statements to us
e.
table name = tabletest
*****************************
* primary key * varchar * integer *
*****************************
* 1 * test * 34 *
*****************************
* 2 * test2 * 21 *
*****************************
The input to the procedure is a 2, and I want the procedure to replace
the 21 with another integer (say 5) while leaving the rest of the row
unchanged, still contains string test2 and primary key 2.
Thanks.
Paul G
Software engineer.Read about the UPDATE command. An example (no column names were given...):
CREARE PROC procname
@.col1 int
AS
UPDATE tabletest
SET col3 = 5
WHERE col1 = @.col1
GO
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
> Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
> following field insertion into a table, just wondering what statements to
use.
> table name = tabletest
> *****************************
> * primary key * varchar * integer *
> *****************************
> * 1 * test * 34 *
> *****************************
> * 2 * test2 * 21 *
> *****************************
> The input to the procedure is a 2, and I want the procedure to replace
> the 21 with another integer (say 5) while leaving the rest of the row
> unchanged, still contains string test2 and primary key 2.
> Thanks.
>
> --
> Paul G
> Software engineer.|||ok, thanks for the information.
"Tibor Karaszi" wrote:

> Read about the UPDATE command. An example (no column names were given...):
> CREARE PROC procname
> @.col1 int
> AS
> UPDATE tabletest
> SET col3 = 5
> WHERE col1 = @.col1
> GO
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
>
>

Data insertion using stored procedure.

Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
following field insertion into a table, just wondering what statements to use.
table name = tabletest
*****************************
* primary key * varchar * integer *
*****************************
* 1 * test * 34 *
*****************************
* 2 * test2 * 21 *
*****************************
The input to the procedure is a 2, and I want the procedure to replace
the 21 with another integer (say 5) while leaving the rest of the row
unchanged, still contains string test2 and primary key 2.
Thanks.
--
Paul G
Software engineer.Read about the UPDATE command. An example (no column names were given...):
CREARE PROC procname
@.col1 int
AS
UPDATE tabletest
SET col3 = 5
WHERE col1 = @.col1
GO
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
> Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
> following field insertion into a table, just wondering what statements to use.
> table name = tabletest
> *****************************
> * primary key * varchar * integer *
> *****************************
> * 1 * test * 34 *
> *****************************
> * 2 * test2 * 21 *
> *****************************
> The input to the procedure is a 2, and I want the procedure to replace
> the 21 with another integer (say 5) while leaving the rest of the row
> unchanged, still contains string test2 and primary key 2.
> Thanks.
>
> --
> Paul G
> Software engineer.|||ok, thanks for the information.
"Tibor Karaszi" wrote:
> Read about the UPDATE command. An example (no column names were given...):
> CREARE PROC procname
> @.col1 int
> AS
> UPDATE tabletest
> SET col3 = 5
> WHERE col1 = @.col1
> GO
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:6A3AA6DC-BC23-446D-A2B4-26A1602BDDF1@.microsoft.com...
> > Hi kind of new to SQL. Anyhow I want to use a stored procedure to do the
> > following field insertion into a table, just wondering what statements to use.
> > table name = tabletest
> > *****************************
> > * primary key * varchar * integer *
> > *****************************
> > * 1 * test * 34 *
> > *****************************
> > * 2 * test2 * 21 *
> > *****************************
> > The input to the procedure is a 2, and I want the procedure to replace
> > the 21 with another integer (say 5) while leaving the rest of the row
> > unchanged, still contains string test2 and primary key 2.
> > Thanks.
> >
> >
> > --
> > Paul G
> > Software engineer.
>
>

Data insertion

Hello,

My project is to update a price table with a text file.
But sometimes, there are new refs in text file that are not in my ref table.

How can i check it and automate the insertion of those new refs

Thanks a lotThe LOOKUP component can tell you what rows in the pipeline are not in the lookup table by setting the component to redirect all rows not found in the target to the error output. There's an explanation of this at http://www.sqlis.com/default.aspx?311

-Jamie