Showing posts with label points. Show all posts
Showing posts with label points. Show all posts

Monday, March 26, 2012

Iterate through a list of files with bcp

I have a folder full of date-stamped files: 010101.txt, 010201.txt,
010301.txt, etc.
I have a working bcp command that points to a specific file.
declare @.bcpCommand varchar(1000)
select @.bcpCommand = 'BCP "Import.dbo.NAV" in
"d:\folder\010101.txt" -c -T -t, -S "SERVER1\SERVER1"'
EXEC master.dbo.xp_cmdshell @.bcpCommand
How can I script the bcp command so it will import all files between say
010101 and 120105? Complicating factor; there are gaps in the sequence. Can
the script continue even if it doesn't find a file?
Alternatively, if it was possible to issue the bcp command against all files
in a folder no matter what the filename, that would work also.
This is a one-time data load with SQL Server 2000/SP4
Thanks to anyone who could help.For sake of simplicity, write a cursor script & get it off. Here is a quick
try:
DECLARE @.cmd VARCHAR(500), @.c VARCHAR(500)
CREATE TABLE #t ( c VARCHAR( 500 ) NOT NULL )
INSERT #t EXEC master.dbo.xp_cmdshell 'DIR d:\folder\*.txt /B'
DECLARE c CURSOR FOR SELECT f FROM #t
OPEN c
FETCH NEXT FROM c INTO @.c
WHILE @.@.FETCH_STATUS = 0
BEGIN
SET @.cmd = 'BCP "Import.dbo.NAV" in "d:\folder\' + @.c + '" -c -T -t, -S
"SERVER1\SERVER1"'
EXEC master.dbo.xp_cmdshell @.cmd
FETCH NEXT FROM c
END
CLOSE c
DEALLOCATE c
DROP TABLE #t ;
Anithsql

Monday, March 19, 2012

Issues in SSRS

I need some inputs regarding the

following points related to the SSRS reports:

1. We have a table in

the report and we want to change the display order of the columns when

downloading the report in the CSV format. What could be the possible approach

for this?

2. How to set bookmarks for a report when

downloading the report in the PDF format?

3. We have a table in the report and we

are hiding few cells of the table based on some condition. Now when a particular

cell is made invisible, a blank space exists at the location of that cell. The

requirement is that if we hide one cell, the cell below it must shift above i.e

at the location of the hidden cell.

In SSRS if we hide one row of a table,

then the row below it automatically shifts upwards, but this is not applicable

for a table cell.

Could anyone please provide vaulable

feedback on these points?

Thanks,
S Suresh

1. Not possible

2. Yes, you can create bookmarks for groups in your report by using "Document map label" feature when you edit the group.

3. Instead of having different cells in a row, merge all the cells and then have a rectangle inside that merged cell and then have multiple textboxes inside the rectangle in the same positions as cells were before. When you control the visibility of these textboxes inside a rectangle, they will move up if the visibility of the above cell is hidden.

Shyam