Registered member login:
Register Now
Altirigos » Deployment Solution » Deployment Server » Migrating DS Console Filters

» Current Poll
Do you leave the Aclient enabled?
YES - 83.05%
196 Votes
NO - 16.95%
40 Votes
Total Votes: 236
You may not vote on this poll.
» Stats
Members: 9,948
Threads: 12,158
Posts: 56,984
Top Poster: Nick (4,991)
Welcome our newest member, rmerrill
» Online Users: 30
0 members and 30 guests
No Members online
Most users online at once 294, 06-30-2007 at 12:24 PM.
» July 2010
S M T W T F S
27282930 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Reply
Old 10-07-2009, 11:55 AM   #1 (permalink)
 
TRYDL's Avatar
 
Status: Super Altiris Admin
Join Date: 03-08-2006
Location: Baltimore, MD
Age: 30
Posts: 666


Migrating DS Console Filters

I am in the middle of a DS migration between two different hardware platforms. One of the requirements was to migrate the numerous custom DS console filters between the two servers. Since I didnt see anything in the KB or here, I wrote up the SQL on how I moved the filters between the servers.

You dont need to use BCP to create the CSVs, it was more for the fun of it . If you read the comments between the SQL, you'll see how the processes were broken down.

Code:
 
/*
Activate xp_cmdshell for calling external program bcp.exe
*/
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
/*
Export known filters to CSV file. Notice that the express database prefix has two periods
*/
DECLARE @sql VARCHAR(8000)
SELECT @sql = 'bcp express..filter out c:\filter.csv -c -t, -T -S' + @@servername
EXEC xp_cmdshell @sql
/*
Export known filter conditions to CSV file. ##Filtertemp is a global temporary table name to be
exposed for use by bcp.exe. Temp table is dropped.
*/

SELECT 
fc.filter_id
,fc.item_seq
,fc.field_type
,fc.oper_type
,fc.key_value
,fc.drive
,fc.conjunct
INTO ##Filtertemp
FROM express..filter f
JOIN express..filter_condition fc
ON f.filter_id = fc.filter_id
WHERE fc.key_value != ''
DECLARE @sql VARCHAR(8000)
SELECT @sql = 'bcp ##Filtertemp out c:\filtercon.csv -c -t, -T -S' + @@servername
EXEC xp_cmdshell @sql
DROP TABLE ##Filtertemp
/*
I removed the canned DS Console filters manually, then copied the CSV files local to the 
new RDP server with a local SQL instance
*/

/*
Bulk import the new filters
*/
BULK
INSERT filter
FROM 'c:\temp\filter.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
/*
Bulk import the new filter conditions
*/
BULK
INSERT filter_condition
FROM 'c:\temp\filtercon.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
__________________
3rd Floor Garage Door Operator
TRYDL is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 05:59 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
vB.Sponsors
Altirigos