Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, May 1, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Data & Imports Forums - T-SQL & Queries
Forum to discuss general T-SQL questions and help with queries related to SalesLogix data. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to T-SQL & Queries | New ThreadView:  Search:  
 Author  Thread: Looking for a SecTableDefs Trick
Carla Tillman
Posts: 290
 
Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 12:57 PM
fiogf49gjkf0d
All,

Does anybody have a down and dirty way to check objects in the database against SecTableDefs? I am analyzing
a modified DB schema that was implemented outside of SLX DBManager. (i.e.: Fields have been added to base A/C/O and other tables directly from SQL) I know I can query the syscolumns and get a handful of items, but the nomenclature is not 100% standard for the custom fields.

thx,
Carla
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 1:53 PM
fiogf49gjkf0d
Tables that are in ReSyncTableDefs but not in the database:


SELECT
R.[TableName]
FROM
[sysdba].[ReSyncTableDefs] R
LEFT JOIN [Information_Schema].[Tables] T
ON T.[Table_Name] = R.[TableName] AND
T.[Table_Type] = 'Base Table' AND
T.[Table_Schema] = 'sysdba'
WHERE
T.[Table_Name] IS NULL
ORDER BY
R.[TableName]


Tables in the database (and owned by sysdba) that are not in ReSyncTableDefs:


SELECT
T.[Table_Name]
FROM
[Information_Schema].[Tables] T
LEFT JOIN [sysdba].[ReSyncTableDefs] R
ON T.[Table_Name] = R.[TableName]
WHERE
T.[Table_Type] = 'Base Table' AND
T.[Table_Schema] = 'sysdba' AND
R.[TableName] IS NULL
ORDER BY
T.[Table_Name]


Timmus
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 2:03 PM
fiogf49gjkf0d
Timmus, my man!
Thanks for the speedy reply. Unfortunately this did not capture what I am looking for, but it did bring up a question; ResyncTableDefs vs. SecTableDefs - What is the deal-i-o between these two entities?

Carla
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 2:06 PM
fiogf49gjkf0d
You are welcome. So what are you looking for?

SecTableDefs is column level metadata. ReSyncTableDefs is table level metadata. Does that answer your question?

Timmus
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 2:11 PM
fiogf49gjkf0d
Here are some more queries that report on issues in SecTableDefs:

Columns in SecTableDefs that are not in the database:


SELECT
S.[TableName], S.[FieldName]
FROM
[sysdba].[SecTableDefs] S
LEFT JOIN
(
SELECT
C.[Table_Name], C.[Column_Name]
FROM
[Information_Schema].[Columns] C
INNER JOIN [Information_Schema].[Tables] T
ON C.[Table_Name] = T.[Table_Name] AND
T.[Table_Type] = 'Base Table' AND
T.[Table_Schema] = 'sysdba'
) C
ON S.[TableName] = C.[Table_Name] AND
S.[FieldName] = C.[Column_Name]
WHERE
C.[Column_Name] IS NULL
ORDER BY
S.[TableName], S.[FieldName]


Columns in the database but not in SecTableDefs (for sysdba tables of course). Note that this also assumes that the tables are in ReSyncTableDefs.


SELECT
C.[Table_Name], C.[Column_Name], C.[Data_Type], C.[Ordinal_Position]
FROM
[Information_Schema].[Columns] C
INNER JOIN [Information_Schema].[Tables] T
ON C.[Table_Name] = T.[Table_Name] AND
T.[Table_Type] = 'Base Table' AND
T.[Table_Schema] = 'sysdba'
INNER JOIN [sysdba].[ReSyncTableDefs] R
ON R.[TableName] = T.[Table_Name]
LEFT JOIN [sysdba].[SecTableDefs] S
ON S.[TableName] = C.[Table_Name] AND
S.[FieldName] = C.[Column_Name]
WHERE
S.[FieldName] IS NULL
ORDER BY
C.[Table_Name], C.[Column_Name]



Columns in the database but not in SecTableDefs (for sysdba tables of course). Note that this DOES NOT assume that the tables are in ReSyncTableDefs. In the case where you are just reporting the issues and not fixing them, this makes more sense. If you are fixing the metadata, I suggest starting with ReSyncTableDefs. Then once that data is correct you will want to include the inner join to ReSyncTableDefs. You dont want columns listed in SecTableDefs that belong to tables that are not in ReSyncTableDefs.


SELECT
C.[Table_Name], C.[Column_Name], C.[Data_Type], C.[Ordinal_Position]
FROM
[Information_Schema].[Columns] C
INNER JOIN [Information_Schema].[Tables] T
ON C.[Table_Name] = T.[Table_Name] AND
T.[Table_Type] = 'Base Table' AND
T.[Table_Schema] = 'sysdba'
LEFT JOIN [sysdba].[SecTableDefs] S
ON S.[TableName] = C.[Table_Name] AND
S.[FieldName] = C.[Column_Name]
WHERE
S.[FieldName] IS NULL
ORDER BY
C.[Table_Name], C.[Column_Name]


Timmus (sorry for the multiple edits - trying to figure out formatting )
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 3:20 PM
fiogf49gjkf0d

SecTableDefs is column level metadata. ReSyncTableDefs is table level metadata. Does that answer your question?

Timmus



That's what I was asking! All this time... I have never used the ResyncTableDefs table.
I am looking into the other queries you kindly supplied. Hopefully I will end up with a full listing of 'unauthorized' customizations and move on.

c
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 3:35 PM
fiogf49gjkf0d
t

BINGO! The second one did it. You are an incredible time saver.

Thanks again!
c
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 6:21 PM
fiogf49gjkf0d
Quote:
Originally posted by Carla Tillman

You are an incredible time saver

This is the result of my aversion to work of any kind :p

I am happy it helped.

Timmus
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Looking for a SecTableDefs TrickYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Aug 06 6:30 PM
fiogf49gjkf0d
Quote:
Originally posted by Timmus Agersea

sorry for the multiple edits - trying to figure out formatting)


Hehe. Sorry about that. I do have some changes coming to the forums (hopefully soon) that will make posting code a whole lot easier.

-Ryan
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 5/1/2024 3:28:16 PM