You know, I've actually had this same problem myself before. And I've written some SQL which will fix the tab level problem. I have not made this SQL completely generic however... so had not posted it anywhere previously. The SQL is intended to be used in SQL Server Management Studio. Perhaps someone else can tweak this for you so that you can run it in your portal in the Host SQL page, presuming you're not SQL skilled.
This is the script I use to reconcile tab level.
declare
@myString nvarchar(1000)
declare
@myCount
int
declare
@myIndex
int
declare
@CurTabId
int
declare
@CurLevel
int
declare
@CurTabPath nvarchar(1000)
declare
@
Update
int
declare
@Verbose
int
-- Update = 1 will cause DB to commit changes
set
@
Update
=0
-- Verbose = 1 will cause query to write report
set
@Verbose=1
-- Set PortalId to fix one portal, or remove WHERE clause to do all
DECLARE
cur
CURSOR
LOCAL
SCROLL
STATIC
READ_ONLY
FOR
SELECT
TabId, [
Level
], TabPath
FROM
tabs
WHERE
PortalID=25
OPEN
cur
FETCH
NEXT
FROM
cur
INTO
@CurTabId, @CurLevel, @CurTabPath
WHILE (@@FETCH_STATUS = 0)
BEGIN
set
@myString =
RIGHT
(@CurTabPath,LEN(@CurTabPath)-2)
set
@myCount = 0
set
@myIndex = 0
WHILE CHARINDEX(
'//'
, @myString) > 0
BEGIN
set
@myCount = @myCount + 1
set
@myIndex = CHARINDEX(
'//'
, @myString)
set
@myString =
RIGHT
(@myString, LEN(@myString)-@myIndex-1)
END
IF @myCount <> @CurLevel
BEGIN
IF @Verbose = 1
BEGIN
PRINT
'--------- '
PRINT
'TabId: '
+
convert
(nvarchar,@CurTabId)
PRINT
'TabPath: '
+ @CurTabPath
PRINT
'TabLevel: '
+
convert
(nvarchar,@CurLevel) +
' should be: '
+
convert
(nvarchar,@myCount)
END
IF @
Update
= 1
BEGIN
UPDATE
Tabs
SET
[
Level
] = @myCount
WHERE
TabID = @CurTabId
END
END
ELSE
BEGIN
IF @Verbose=1
PRINT
'TabId: '
+
convert
(nvarchar,@CurTabId) +
' : OK'
END
FETCH
NEXT
FROM
cur
INTO
@CurTabId, @CurLevel, @CurTabPath
END
PRINT
'Finished.'
CLOSE
cur
DEALLOCATE
cur