MS SQL Server Tree Structure

Sep 11, 2007

Can anyone please help me? I need to create a tree structure of my company's database server. I need to include all the tables and their description in a tree structure. The output can be in any format. Is there some tool in the MSSql that will do this for me, so I don't have to write it out manualy?? Thank you very much for any ideas!!
M.

View 5 Replies


ADVERTISEMENT

SQL 2012 :: Sort Tree Members In Right (tree) Structure?

Apr 6, 2015

I got assignment, how to make it appear in the right order .

/* DROP TABLE EMP
SELECT * INTO Emp FROM (
SELECT 'A' EmpID, NULL ManID, 'Name' EmpName UNION ALL
SELECT 'MAC' EmpID, 'A' ManID, 'Name__' EmpName UNION ALL
SELECT '1ABA' EmpID, 'MAC' ManID, 'Name____' EmpName UNION ALL
SELECT 'ABB' EmpID, '1ABA' ManID, 'Name______' EmpName UNION ALL
SELECT 'XB' EmpID, 'A' ManID, 'Name__' EmpName UNION ALL
SELECT 'BAC' EmpID, 'XB' ManID, 'Name____' EmpName ) b
*/

[code]....

View 2 Replies View Related

Selfjoin Problem With Tree Structure

Aug 23, 2004

I have the following table
Memberid int
submemberid int

example
MemberId SubMemberId

1 2
2 3
1 4
3 5
2 6
7 8

Each member may supervise more than one member under him (whom I call submember)
and then each sub member may also supervise more than one member under him
I need to be able to select a specific member for example whose id is 1 and consequently all his sub members should be selected whose also all submembers should be selected and so
on
I do not know how to do this here is my trial:



ALTER Procedure dbo.MemberReports;1

@MemberMaskId nvarchar(8)


As
SET NOCOUNT ON
Begin
Declare @Exists Int -- Return Value

-- Select * from MembersTree where MemberId = @memId or MemberId = subMemberId


SELECT
MembersTree.memberid,
MembersTree.submemberid,
MembersTree1.memberid
FROM
MembersTree
INNER JOIN
MembersTree MembersTree1
ON MembersTree.Submemberid
= MembersTree1.memberid

WHERE
MembersTree.MemberId = @memId

If @@rowcount = 0 -- No Record returned
Select @Exists = 0
Else
Select @Exists = 1
Return @Exists

End

Please help,
Thanks

View 2 Replies View Related

Tree Structure Select Problem

Nov 6, 2005

hello i have a table with four fields : name_id, name, tree_id, level withthese data:1 name1 001 12 name2 002 13 name3 003 14 name4 001001 25 name5 001002 26 name6 001003 27 name7 001001001 3tree:1-- 4-7-5-62-3-and procedure which add nodes to tree looks tree.add(idparent,idchild,name)how to write select which returns idparent,idchild and name then i can addnodes in loop reading datareader ?

View 4 Replies View Related

Unknown Tree Structure Table Design???

Dec 11, 2006

hello friends!
Can any body guide me regarding Tree/hierarchy Multi-Referential table structure.

What i have is only for known tree structure i.e upto 3 or 4 level but if i waanna to find nth level hoe shud i design my table structure.

T.I.A

View 3 Replies View Related

Joining Two Tables To Modify A Tree Structure With More Information

Jul 30, 2007

I’m trying to create a modified catalog tree out from two tables in sql

The catalog is created from two tables.

Table 1 has the lowest level and is showing the connection with the item and the lowest ItemGroup. It also shows the connection with the MainCatalog

MainCatalogId, ItemGroupId, ItemId

Example data:

(sorry for the tabs that won't work)
MainCatalogIdItemGroupIdItemId
715063823
715073824
715093825
715093826

The catalog structure is in table 2. Here are the connections between the different


ItemGroupId, ParentId

Example data:

ItemGroupIdParentId
15061365
15071365
15091364
13641066
13651066
1066NULL

To be able to use create the tree structure and not getting the result set to big, I need it to look something like this:

ItemGroupIdItemIdLevel 2 level 3Level4
1506 3823136510667
1507 3824136510667
1509 3825136410667
1509 3826136410667

I have tried many ways, but I’m not getting the result I want.

Hope this was understandable, and that someone has an idea if this is manageable


Thanks :)

View 1 Replies View Related

Retreiving Tree-Structure Data From A Table Throug

Apr 7, 2007

Hi all
I have a Table with Following structure ( a Tree Structure )

PK Parent Level Code
--- -------- ------- ------
1 0 0 100
2 1 1 101
3 1 1 102
4 2 2 103
5 3 2 104
6 4 3 105

The same as following Tree as you can see
1__
| 2__
| 4__
| 6
| __
3__
5

I need a query to return the following Result. I think it is possible only through Nested sub-Queries But i don't know how to do that
Could any one help me.?


PK Parent Level Value First-Parent' Code 2nd-Parent's Code 3rd-Parent's Code
---- -------- ------ ------- --------------------- ---------------------- -----------------------
1 0 0 100 NULL NULL NULL
2 1 1 101 100 NULL NULL
3 1 1 102 100 NULL NULL
4 2 2 103 101 100 NULL
5 3 2 104 102 100 NULL
6 4 3 105 103 101 100

Any help greatly would be appreciated.
Kind Regards.

View 2 Replies View Related

Hierarchical (tree) Data Structure Where A Node Can Have Multiple Parents

May 9, 2008

Hi all!
I am trying to organize a hierarchical data structure into a table. I need to have the possibility to set 2 parents for some nodes. Curently I see following two options:
Example 1
id    parent_id    name-----------------------------------1     0                 Level 1 Parent A2     0                 Level 1 Parent B3     1,2              Level 2 Child
Example 2
id    parent_id    name-----------------------------------1     0                 Level 1 Parent A2     0                 Level 1 Parent B3     1                 Level 2 Child3     2                 Level 2 Child
Is any of the two examples valid database logic wise? In fact, is it possible to achieve the requirement by using only one table?
Thanks in advance,

View 4 Replies View Related

Drill Through Report Problem For Implementing Tree View Structure

Dec 21, 2007



Hai Iam new to SSRS 2005, please help me regarding below Drill Through Report Problem. Assum my problem with below example.Iam tried Hard iam not able to find the solution, Any body please help me.my real time problem is same as below functionality



If Suppose iam dispalying two columns like Country,Department,iam taking these two columns in a table, assume country column having America,south africa, individual america column having Florida state, south africa column contains capetown state, in the preview of the report iam applying drilldown to America column like + America, i need when clicking the America column i want to display Florida state under the column of Country like tree view structure

i need output like this and the same time i want to display other columns those also contain tree view structure assume other one is department column, with contains computers and sales, individualy computers contains HP, Sales contains Bikes

Country Department

+ America + Computers

---Florida -- HP

+ SothAfrica + Sales

---Capetown __Bikes



How to implement above output using drill through functionality, i tried with subreports and used all grouping formats, is possible for display output like above explain the procedure .

Thanks In advance

Jacks













View 3 Replies View Related

T-SQL (SS2K8) :: Finding Tree Structure - Show All Upward And Downward Nodes

Jun 3, 2015

I have the following table:

SELECT 'A' as Item, '1' as Version, 0 as Counter, '01-01-2011' as CreatedDate UNION ALL
SELECT 'A' as Item, '1.1' as Version, 1 as Counter, '01-02-2011' as CreatedDate UNION ALL
SELECT 'A' as Item, '1.2' as Version, 2 as Counter, '01-03-2011' as CreatedDate UNION ALL
SELECT 'B' as Item, '1.2' as Version, 0 as Counter, '01-01-2011' as CreatedDate UNION ALL

[Code] .....

I want to write a script where if a user enters the version number, then the output should show all the upward and downward nodes..e.g. if a user selects '1.2' version then following should be the output

View 3 Replies View Related

Any Structure On Sql Server Like WITH ... SELECT Structure On DB2

Jul 20, 2005

Hi,I'm using DB2 UDB 7.2.Also I'm doing some tests on SQL Server 2000 for some statements touse efectively.I didn't find any solution on Sql Server about WITH ... SELECTstructure of DB2.Is there any basic structure on Sql Server like WITH ... SELECTstructure?A Sample statement for WITH ... SELECT on DB2 like belowWITHtotals (code, amount)AS (SELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY code)SELECTcode, SUM(amount)FROM totalsGROUP BY code.............................Note: 'creating temp table and using it' maybe a solution.However i need to know the definition of the result set of Unionclause. I don't want to use this way.CREATE TABLE #totals (codechar(10), amount dec(15))GOINSERT INTO #totalsSELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY codeGOSELECT code, sum(amount) FROM #totals GROUP BY codeGOAny help would be appreciatedThanks in advanceMemduh

View 3 Replies View Related

Decision Tree In MS SQL Server

Jun 28, 2007

Hi,



Can we represent the Decision Tree in a programatically way in an .NET application? I understand that the outcome of a Decision Tree model can be integrated into an .NET application but not sure if we can also visualize it. Does MS SQL Server support any API to render such a tree?



Thanks a lot!

View 3 Replies View Related

Hierarchy Tree In Sql Server

May 15, 2008



Hai


do we have hierarchy query in sql like connect by prior in oracle to dispaly values in tree structure


Help needed

Tahnks in advance
Sumathi.s

View 4 Replies View Related

Recursive/Tree Queries In SQL Server.

Feb 18, 1999

Dear fellows,
Can anybody tell me how can i apply recusive/Tree query using select
statement.
For example I've a table structure for an Organization as follows:

TableName: Employee_tbl
Fields: emp_id, emp_name, supervisor_id

emp_id emp_name supervisor_id
---------- --------------- -------------------
101 ZAFIAN
102 BRUNNER 101
108 CALLAHAN 102
105 RUSSO 102
110 SIM 102
103 DUELL 101
and so on

1. How can I get the above records in Hirarchical format starting from top
or from anywhere else in the hierarchy?

In Oracle it can be done as follows:
SELECT emp_id,emp_name,supervisor_id
FROM employee_tbl
CONNECT BY supervisor_id = PRIOR emp_id
START WITH supervisor_id is null;

Please reply me at the following address if possible:
faisal@visualsoft-inc.com

View 1 Replies View Related

SQL Server 2012 :: Traversing Down A Tree

Feb 9, 2015

I'm working with a development bug database where if someone puts in a bug number, they want to get the parent bug. No problem.

SET @cur_parent = (SELECTdupeof_key
FROMqds.dbo.Dimduplicates d
WHEREd.dupe_key = @checkbug
ANDd.end_ts IS NULL)
WHILE @cur_parent IS NOT NULL

[Code] ...

However, now they want to be able to do the same thing in reverse. Put in a bug and determine how many bugs are duplicates (either directly - children, or indirectly - grandchildren/great-grandchildren, etc.).

The majority of bugs go no more than three generations deep but there are some that go much deeper so I need to have something where I can loop through each potential generation and get the number of bugs associated with it.

Example.

Parent Bug Child Grandchild GGChild
1 2 3 4
1 5
1 28 32
1 40 41 42
1 50
1 60
1 65 70

If I put in bug 1 I should be able to get a count of 13 associated duplicate bugs. Additionally, they want to be able to get a list of the bugs that are associated with that parent.

If there were a set number of levels, self-joining would work to create a generational matrix. However, as there is no limit on how deep the generations can go, I need something dynamic to traverse the tree and generate the list of bugs/count of bugs.

It was easy going up the tree because there was a strict one-to-one relationship between child and parent.

View 9 Replies View Related

Sql Server 2005 And Tree Structures

Mar 9, 2007

I am trying to traverse a tree structure like below,

1 Pets
--1.1 Cat
----1.1.1 Persian
----1.1.2 Bengal
--1.2 Dog
----1.2.1 Poodle
2 etc

I would like to be able to search by a keyword, i.e. Poodle, or the reference number, i.e. 1.2.1. I would prefer to do this all through a stored procedure if possible, it seems recursion is the way to go as the number of levels may increase in the future but i'm completely new to this. From what i've seen so far I would need a table structure with a parentID,NodeID,Name field and Primary key.

i.e,

ID...Name......Parent.....NodeID
1....Pets.........0............1
2....Cat..........1............1
3....Dog..........1............1
4....Persian.....2............1
5....Bengal......2............2
6....Poodle......3............1
etc

i've heard that SQL SERVER 2005 provides recursion through CTE, is this the recommended way/only way to achieve this?

Any tips on where to start would be really appreciated.

View 3 Replies View Related

Tree View With A SQL Server Database

Jul 20, 2005

We need to present hierarchical data on a web page, the same way thetree view shows files in Windows Explorer. Here's the catch: thattree view needs to be bound to a SQL Server database. How can this bedone?

View 3 Replies View Related

SQL Server 2008 :: Export Tree Data To XML

Feb 23, 2015

I am trying to output the hierarchical data of a tree to xml format.

I can query the data from the tables into a friendly format like this:

create table dummy
(
id int,
childname nvarchar(max),
parentid int,
parentname nvarchar(max)

[Code] ....

And I always know the root ID from the first record on "table" dummy (generated with a common table expression), in this case it's ID 1, but from here, how to process this for any level of depth ?

View 6 Replies View Related

How To Get 2 Level Tree Node In The Sql Server 2005

May 30, 2008

hi,

How to get 2 level tree node in the sql server 2005. We have table with data.On load we populate the tree in Asp.net.

Regards,
Vinayak Panchal

View 2 Replies View Related

SQL Server 2012 :: How To Copy Nested Sub-tree From One Node To Another

May 12, 2015

I have a tree and I need to copy a nested sub-tree (an element with its children, which in turn may have their owns) from one place to another.

The system should allow to handle up to 8 levels. I do know how to move, but cannot figure out how to copy.

Below is a working example With Create Table, Select and Cut / Paste (implemented via Update).

I would like to know how to copy a nested tree with reference id 4451 from Parent_Id 1 to Parent_Id = 2

--***** Table Definition With Insert Into to provide some basic data ****

IF (OBJECT_ID ('myRefTable', 'U') IS NOT NULL)
DROP TABLE myRefTable;
GO
CREATE TABLE myRefTable
(
Reference_Id INT DEFAULT 0 NOT NULL CONSTRAINT myRefTable_PK PRIMARY KEY,

[Code] ....

How to Copy nested sub-tree 4451 with all its children to Parent_Id 2, without deleting from Parent_Id = 1 ?

View 7 Replies View Related

Possible To Speed Up The Decision Tree By Clustering The Server 2003

Aug 24, 2007

Dear All,


I have a dataminig programming that need to run for days. Is it possibile to speed up the training process by clustering several server by Windows 2003 clustering services? Is it actually that clustering 2 QUAD core computer is almost giving comparable performance as the sum of the speed of two (There must be some overhead, I know). I am actually familiary with the use of clustering. Is it just for making the server farm more reliable or it will collaborate and speeed up the whole training process?

If it is, is there any limit on the number of cluster is in the cluster. What version of Windows and SQL Server do I need to achieve speed up of data mining training process?

Thanks and regards

Tony Chun Tung Siu

View 3 Replies View Related

Time Series In SQL Server 2005 Desicion Tree Interpretation

Aug 12, 2007



Dear All
The problem is I am going to predict the production for different category of product.
attributes are
year - key
A production - predict only
B production -predict only
C production -predict only

And in the SQL it is impossible to to give input and predict (I am not sure whether that is a error or not).

And in the decision tree
for the
Product A - get as product A >=12324
Product B year > 2000
Product C product C >=35454


I want to know why the label is changing time to time.
Please help me on this. Thank you
Menik



View 3 Replies View Related

How Can I Get The 'entire' Database, Structure And Data, From SQL Server 2008 To SQL Server 2005?

Jun 20, 2008

1) I can't get the 'copy database' function to work from SQL Server 2008 to SQL Server 2005. I connect ok. Everything goes to the last step and then it fails.2) I cant get a SQL server 2008 backup to restore on SQL SEerver 2005 either.
The only way I know that works is to script the creation of all tables then export and import. This does work.
How can I get the 'entire' database, structure and data, from 2008 to 2005?
ThanksSQL newbie.

View 2 Replies View Related

How Do You Describe A Table's Structure In SQL Server?

Apr 16, 2004

Oracle has a similar function, DESC, to diplay the table structure. Can't figure it out in SQL Server.

ddave

View 2 Replies View Related

Table Structure Of Linked Server

Aug 2, 2005

Hello!Does anybody know how to get tables structure of linked server (DBF tablesvia ODBC connection). I know that table structure of "normal" (not linked)server can get from systables and syscolumns tables, but now I need astructure of linked server tables.Thanks!

View 1 Replies View Related

Can't See Any Folder Structure In The Report Server ?

Jan 30, 2007

Hi i have my customer security method using the

http://msdn2.microsoft.com/en-gb/library/ms160724.aspx msdn article !

now my problem is i can login using different different users login

but i can view the deployed folder sturcutre using one user account only,others just have the accees to the connect to the report server only ?

but in my rsreportserver.config file

i already added three seperate user account like this

<adminconfiguration>

<username>asd></username>

<username>asd1></username>

<username>asd>2</username>

<adminconfiguration>



and i have added these user name on to the report report server users table as wel,

but problem is again i can see folder structure using asd2 user login only,other users just have the login permision ony,they cant see the folder structure ?

what is the problem with this ?

regards

sujith !



View 4 Replies View Related

Copy SQL Express Table Structure To SQL Server

Dec 16, 2005

How does one generate Transact-SQL for table structure in SQL server express 2005?
I have very limited access to an SQL server database (using rudimentary web based interface) for my hosted website.  I am ready to deploy an application that was developed with Visual Studio 2005 using SQL server express as the database.  I have four tables that I want to copy (structure only) from "express" to the hosted SQL server.  I think I need to generate Transact-SQL statements to "create" the table structure, then run these statements as a stored procedure on the web based SQL server.  I'm having trouble trying to figure out how to generate the code from SQL express 2005.  Anyone had any experience with this?
thanks.

View 1 Replies View Related

Import Directory Structure Into SQL Server Database

Jan 23, 2008

Hi,

As stated in the subject, I need to import a complete directory structure, from a root folder that I specify into a SQL Server database. To add further complexity, I also need to see what files exist in each directory.

At the end of the day what I am trying to achieve is to populate a table that will essentially have two columns, the filename and the directory that the file resides in. I am running SQL Server 2005.


Has anybody ever done anything like this before using T-SQL?

Thanks in advance.

View 5 Replies View Related

SQL Server 2012 :: Structure For Multiple Nested Queries

Feb 27, 2014

I am using Server 2012 and very new to SQL. I have a request from a physician for a list of his patients that meet a criteria. This is stored in a temp table names #cohort.

Using this cohort he wants each row to be one patient with a list of labs, vitals, etc. Three items are the most recent lab value and date. I could query each lab individually and place it into a temp table and then join all temp tables at the end, but I am trying to move past that and have all labs in one temp table. All temp tables are joined with PatientSID.

I tried to do something for just 2 labs, but it is not working. There could be nulls values when joined with the #cohort table.

Individually the SELECT statements pull in the most recent lab value and date, but I cannot get them into a temp table with one row of PatientSID and then the lab value and date if they exist.

IF OBJECT_ID ('TEMPDB..#lab') IS NOT NULL DROP TABLE #lab
SELECT
cohort.PatientSID
,SubQuery1.LabChemResultNumericValueAS 'A1c%'
,SubQuery1.LabChemCompleteDateTimeAS 'A1c% Date'
,SubQuery2.LabChemResultNumericValueAS 'LDL'

[Code] .....

View 1 Replies View Related

My Structure Contains Mutli Databases In One Server, Will That Affect Mirroring ?

Mar 19, 2008



With the Synonym, I was encouraged to separate my db to several smaller dbs, like base,dynamic,static and security. Now I am trying to use mirroring, I see it may cause problem, I think I need mirror all them to another server. My question is when the server is down, will all db switch to mirror server in the same time? And one can manually set which db is the principal db, but in my case, it will not work if principal server of all four dbs are not the same.

Any thought?
thanks

View 3 Replies View Related

Does Anyone Know How To Modify Table Structure In Sql Server Management Console(2005)? Thanks

Jun 16, 2005

does anyone know how to modify table structure in sql server management console(2005)? thanks

View 1 Replies View Related

SQL Server Admin 2014 :: Restore DB1 To DB2 (with Different Filegroups And Files Structure)

Mar 23, 2015

What is the best method to restore a DBTest1 (with one .mdf and one .ldf) into DBTest2 (with one .mdf, multiple .ndf data files and with 4 filegroups associated with specific data files). I do not see how the one .mdf file (in DBTest1) can be separated into the other 4 filegroups (in DBTest2). This does not sounds like it is possible with Backup DBTest1/Restore to DBTEST2 or (Detach/Attach) because the underlying filegroup and file structure is different.

What method should be used to get the data and structure from DBTest1 (includes 1100 Tables and 550 GBs of Data) into DBTest2 (with 4 filegroups)? Is the following possible:

1) First, in DBTest2, execute a script to create tables/indexes on appropriate filegroups.

2) In DBTest2, use scripts to pull data from DBTest1 into DBTest2, for example INSERT INTO DBTest2.dbo.tables with SELECT FROM DBTest1.dbo.tables OR use SELECT/INTO DBTest2.dbo.tables FROM DBTest1.dbo.tables.

Or, is it possible to use the BULK INSERT or BULK COPY Options? Export/Import Wizard?

Does the Create Index step needs to be done after the data is loaded into DBTest2?

View 3 Replies View Related

SQL Server Admin 2014 :: Structure Of Log Saving (for Data Mining)

May 12, 2015

We saved huge log data from user behaviour in our site .

But In data mining time , we saw that most of them cant use for data mining

What is the best practice about data gathering from user movement in site?

is there any best practice Template for this ?

View 0 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved