Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help required SQL query(perl script required)

Author  Topic 

deepu2812
Starting Member

4 Posts

Posted - 2010-02-10 : 07:30:55
Hi Friends,

There is a urgent requirement in our project related to SQL queries. I don't have much knowledge on SQL/script. Need to write an script with the following requirements(Need to use only SQL queries in the script, we should not use PLSQL). Please can anyone help on this


Inputs to this script(perl) - Primary Key1, Associated Value1

What does it do: The script queries a table a table_t. This table has two columns Primary Key and Associated Value. The script gets Associated Value value for Primary Key passed in the query. If the output is a csv (comma separated value), then it appends Associated Value1 to the output and updates the value in the DB.. If the output is NULL, then a new row is added with the value Primary Key1, Associated Value1.



Eg.

BEFORE

Primary Key Associated Value

abc J1,J9

pqr

mno J8

xyz J3,J5




script(mno, J3);

script(pqr, J5);

script(xyz, J2);

script(efg, J6);



AFTER

Primary Key Associated Value

abc J1,J9

pqr J5

mno J8,J3

xyz J3,J5,J2

efg J6



Thanks in advace.
Deepu

Kristen
Test

22859 Posts

Posted - 2010-02-10 : 07:37:55
Kindly stop posting duplicates all over the place, one posting is sufficient

Reply here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=139654
Go to Top of Page
   

- Advertisement -