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 |
faijurrahuman
Starting Member
15 Posts |
Posted - 2012-03-14 : 10:19:45
|
Dear all;DECLARE @id INTDECLARE @type INTDECLARE @name VARCHAR(max)DECLARE @tables VARCHAR(max)DECLARE @physical NVARCHAR(max)--CREATE TABLE #tmp (id INT IDENTITY(1,1),physical_name VARCHAR(max))--DROP TABLE #tmpDECLARE tmp CURSOR FORSELECT id,type,name,tables FROM dbo.dynamic_update_pagesOPEN tmpFETCH NEXT FROM tmp INTO @id,@type,@name,@tablesWHILE @@FETCH_STATUS = 0BEGIN--INSERT INTO #tmpSELECT DISTINCT D.name,t.physical_nameFROM dbo.Split2(@tables, ',') AJOIN tables t ON t.id=A.idJOIN dynamic_update_pages d ON d.name=@nameFETCH NEXT FROM tmp INTO @id,@type,@name,@tablesEND CLOSE tmp DEALLOCATE tmp OUTPUTView Art Work artworkView Art Work print_adsExpected OutputView Art Work artwork,print_adsI want the csv values for t.physical_name any ony help the issueThanksShare Knowledge team |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-03-14 : 10:26:45
|
Please givetable structuresample datawanted result No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
faijurrahuman
Starting Member
15 Posts |
Posted - 2012-03-14 : 10:38:57
|
Hi This is my table(dynamic)id type dynamic_name dynamic_table_id2 2 View Art Work 1072,13103 2 Update Art Work 10724 2 View Module 1090Here i want compare these table_id in tables tableTables table structuretable_id table_name1072 Print Ads1090 Modules1310 Print AdssI want compare to this tables table table_id and dynamic table table_id and to select the table_name in tables table.dynamic_name , dynamic_table_id , table_name View Art Work 1072,1310 Print Ads,Print AdssUpdate Art Work 1072 Print AdsView Module 1090 ModulesThis is expected output.Share Knowledge team |
 |
|
|
|
|
|
|