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.
Author |
Topic |
logpop
Starting Member
16 Posts |
Posted - 2013-07-30 : 18:09:52
|
Can someone help me write this sql procedure:for each product in productsTable:if productName is in this format: name1|property1| (ie one | character at end of name, other somewhere before)and product with name1 doesn't exist in table:insert new product into productTable which is copy of this product, only name has name1 (without |property|). thanks for help :) |
|
MuMu88
Aged Yak Warrior
549 Posts |
Posted - 2013-07-30 : 18:24:20
|
You will get a quicker response if you post your question following these guidelines:http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-31 : 01:31:34
|
translating your explanation directly to t-sql would be something like thisINSERT ProductsTable (ProductName)SELECT LEFT(ProductName,CHARINDEX('|',ProductName)-1)FROM productsTableWHERE LEN(productName) - LEN(productName,'|','')=2AND productName LIKE '%|%|' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|