Author |
Topic |
subrata.bauri
Starting Member
17 Posts |
Posted - 2011-05-28 : 03:59:16
|
Dear Sir,I have a Table given below in SQL DB & want to go record by record (Alive to Vinit) to these Table . How can I do ?Employee ID Basic Salary Joining Date Alive 10000 01/04/2009 Neel 20000 01/04/2010 Vinit 30000 01/04/2011Kindly reply.It is not a slight thing when those so fresh from God love us. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-28 : 04:54:25
|
what do you need to do with these records ?Just retrieve it ? or update these records ? KH[spoiler]Time is always against us[/spoiler] |
|
|
subrata.bauri
Starting Member
17 Posts |
Posted - 2011-05-28 : 05:34:18
|
I will use every record to filter another table for some purpose.It is not a slight thing when those so fresh from God love us. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-28 : 05:42:33
|
then just INNER JOIN it to "another table"SELECT *FROM this_table t INNER JOIN another_table a ON t.some_col = a.some_col KH[spoiler]Time is always against us[/spoiler] |
|
|
subrata.bauri
Starting Member
17 Posts |
Posted - 2011-05-28 : 05:48:08
|
Thanks for instant reply.Now I want to do some process for every single record that's why I want to go row by row.How to achieve that ?**********************************************It is not a slight thing when those so fresh from God love us. ********************************************** |
|
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-05-28 : 05:59:33
|
quote: Originally posted by subrata.bauri Now I want to do some process for every single record that's why I want to go row by row.How to achieve that ?
some process means......?--Ranjit |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-28 : 06:41:02
|
what kind of processing do you need to do ? KH[spoiler]Time is always against us[/spoiler] |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2011-05-28 : 13:52:53
|
Follow the advice of khtan - an INNER JOIN will allow you to do the full range of SELECT,INSERT , DELETEIs this a one-off process or part of an application?Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2011-05-28 : 23:29:14
|
>> I have a Table given below in SQL DB & want to go record [sic] by record [sic] (Alive to Vinit) to this Table . <<Please post real DDL. Learn to use ISO-11179 rules for the data element names, avoid needless dialect and use ISO-8601 temporal formats, codes and so forth. People cannot read your mind, so post your code and clear specs if you really want help. What you did post was awful. Here is a guess at what you meant. CREATE TABLE Personnel(emp_name VARCHAR(35) NOT NULL PRIMARY KEY, basic_salary_amt DECIMAL (10,2) NOT NULL, hire_date DATE NOT NULL));Your question is completely wrong. Files have records. Records are accessed one at a time. SQL uses tables of rows and works with sets all at once. Please read any book on RDBMS or SQL. --CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL |
|
|
subrata.bauri
Starting Member
17 Posts |
Posted - 2011-05-30 : 01:16:46
|
I have a Temporary Table which has no of records (Rows). Now I want to go these Temp Table thru row by row. Is it Possible in SQL ???**********************************************It is not a slight thing when those so fresh from God love us. ********************************************** |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2011-05-30 : 02:57:31
|
Yes , it is possible . As mentioned earlier - It is as simple as a)creating the recordset via some SQL b)doing something with that recordset .That might be updating another table, deleting from another table etc. Would you be able to give some more information about what changes you are trying to do on the other table?Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
subrata.bauri
Starting Member
17 Posts |
Posted - 2011-05-30 : 05:11:53
|
Suppose in a certain Table I have all the required data. Item Code is a field of this table.Item--- BPD (finished Good)has three child Items BPD01, BPD02, BPD03 and BPD01 has tree child Item -- BPDX01, Qty-3 BPDX02, Qty-5 BPDX03, Qty-2BPD02 has tree child Item -- BPDX04, Qty-1 BPDX02, Qty-4 BPDX01, Qty-2BPD02 has tree child Item -- BPDX03, Qty-6 BPDX04, Qty-5 BPDX01, Qty-6Some one give the input --BPD and Output will beItem Code QtyBPDX01 11BPDX02 9BPDX03 8BPDX04 6BPD & BPD001,BPD002,BPD003 has a relation.BPD001 has relation with its child(BPDX01) Item but BPD has no direct relation to BPDX01...**********************************************It is not a slight thing when those so fresh from God love us. ********************************************** |
|
|
|