GNU/Linux JBoss Fuse Shell ActiveMQ Commands

Display basic queue information…

activemq:query -QQueue=* --view Name,EnqueueCount,DequeueCount,QueueSize

Display queue messages…

activemq:browse --amqurl tcp://localhost:61616  --user [username] --password [password] queue:[queuename]

Purge a specific message from the command line…

activemq:purge --msgsel "JMSMessageID='ID:XXXXXXXX-000000-0000000000000-0:0:00:0:0'" [queuename]

Purge all messages from a specific queue…

activemq:purge [queuename]

MSSQL Bulk Import / Export

Create a format file using BCP command line tool.

bcp DatabaseName.dbo.TableName format nul -S ServerName -T -c -t ',' -r '\n' -x -f X:\Path\To\FormatFile.xml

Export a table to a CSV-File using a format file (BCP).

bcp DatabaseName.dbo.TableName out X:\Path\To\ExportFile.csv -S ServerName -T -f X:\Path\To\FormatFile.xml

Insert data from a CSV-File using a format file (OPENROWSET).

INSERT INTO dbo.TableName
SELECT * FROM OPENROWSET (BULK X:\Path\To\ExportFile.csv', FORMATFILE = X:\Path\To\FormatFile.xml') AS rows
WHERE IDColumn < 200;

Insert data from a CSV-File (BULK INSERT).

BULK INSERT dbo.TableName
FROM 'X:\Path\To\ExportFile.csv'
WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR ='\n');