Jump Or Detect Corrupt Lines In DTS

Mar 7, 2001

Hi,

I import from CSV files into MSSQL tables.
My hierarchy absolutely wants to keep the CSV standard format.
Some string have quotes inside.
With Sybase it jumps these corrupted lines.
With MSSQL and DTS, it breaks all the importation.

Does anyone know how to jump (aloso is there a possibility to detect the number of corrupted lines, Sybase can do that) ?

Thanks for your answers

Best Regards

Axel

View 1 Replies


ADVERTISEMENT

Navigate To:Jump To Url Then Jump To Url Again!

Apr 17, 2007

I am stuck on this and its happening no matter what I do. I have a huge project that holds tons of reports. Most are sub-reports.



I have 5 sections I will just use one for example



communictions (totals)

jump to report - summary data

Jump to report - detail data.



The when I get to the detail data I always get the error:



The path of the item '(null)' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath)



I have tried to do all sorts of things and no matter what I do I cant get it to work.



This is a web application using the ReportViewer for the web, SQL Server 2005 SP2



I have searched high and low for an answer to this and nothing works, not even the get instead of the post.



Any ideas on how I can get this to work?



Thanks



Stokh

View 3 Replies View Related

Using Jump To Report Navigation Option- Jump To The Same Report

Apr 28, 2008



I have a report that uses report parameters and navigation in the textbox.
When I click in the textbox, it jumps to the same report, but I cannot see the report parameters any more(hidden ). I cannot change the report parameters.
When I use only the report paramenters (no navigation option), they appear always during the run time.
How can I do to keep the report parameters visible all the time using "jump to the same report"??

Thank you so much. indyw

View 6 Replies View Related

Jump To URL

May 8, 2007

to open a report in a new window

i looked up the following line of code



=window.open('" & Globals!ReportServerUrl & "?" & Globals!ReportFolder & "/" & "myreport" & "&rs:Command=Render&rc:toolbar=true','','width=800,height=600,left=10,top=10,resizable=1,menubar=no,location=no,status=no'),_top"



I do not understand what & Globals!ReportServerUrl & "?" & Globals!ReportFolder & "/" & "myreport" &

this implies.



I have the current report name as

http://houapps277/ReportServer/Pages/ReportViewer.aspx?%2fIMS-Reports%2fCR000648



and I need to jump to

http://houapps277/ReportServer/Pages/ReportViewer.aspx?%2fIMS-Reports%2fCR000699



both reports are in same folder IMS-Reports.



Thanks

View 3 Replies View Related

Jump To Url

Nov 2, 2006

I use the "jump to url" in a report that links out to a page on our company intranet. Our internal users have to use http and an external user needs to be routed to the site w/ https. How can I account for this in a report?

View 3 Replies View Related

Jump To URL ....

Apr 2, 2008



Hi...

I want to add two link(navigation) buttons in SINGLE CELL ... if i click on 1st it should navigate to xyz page and if i click on second then it should navigate to abc page...can u pls help me...

Waiting for ur reply...

Roopesh Babu V

View 7 Replies View Related

Jump To URL & Javascript

Oct 23, 2007

Hi, I am trying to link to a page outside of reporting services from a report. I am using SQL Server 2005 Reporting Services [Standard Edition]. The hyperlink works if it is a straight URL, however, nothing happens if I modify it to use Javascript so I can open the link in a new window. I have found many posts on the web from others indicating it should be really easy, but I can not get the link to recognize ANY Javascript (also tried a basic alert with no luck).

The Javascript I am using is well formatted. I can place it into a test page and it runs fine. I can also RC and View Source on my report, grab the entire link, put it in a test page and it works fine. It just doesn't work from the report - ?

Any ideas?

Thanks in advance,
Francine

View 3 Replies View Related

Jump To Document Map

May 9, 2008

When you use the Jump to Report feature is there a way to also go to a specific document map link?

View 5 Replies View Related

Jump To Report

Feb 1, 2007

Hi

I want to use Jump to Report option under Navigation tab.

I have two reports both with Same parameters and parameters are multiple value selectable.

In Jump to Report this is how I set the parameter value.

LeadershipTeamId =Join(Parameters!LeadershipTeamId.Value,", ")

CostCentreId =Join(Parameters!CostCentreId.Value,", ")

CostElementGroupId =Fields!CostElementGroupId.Value

This works fine if I have only one value selected for CostCentre and LeadershipTeam but when I select the multiple value I get the following error.

The value provided for the report parameter 'LeadershipTeamId' is not valid for its type. (rsReportParameterTypeMismatch)

Am I missing anything here?

Any help would be highly appreciated.

Best Regards

View 2 Replies View Related

Jump To URL Error

Jul 27, 2007

I'm trying to put a hyperlink in a field on a report. I've found the action property and set the "Jump To" box with the following:


="http://dveowb01.wbhq.com/UnitsStatusLog/StatusEntry.aspx?Unit=" & Fields!Unit.Value

I'm getting this error message:


The Hyperlink expression for the textbox €˜textbox24€™ refers to the field €˜Unit€™. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

Please help.

Thanks,
Jennifer

View 2 Replies View Related

Jump To Report

Mar 5, 2007

Hi all,

I have created a hyperlink(textbox) with an action property setting of "Jump to report" The report I am jumping to takes 5 parameters. I want to pass 4 of the parameters from the main report and have the user enter the 5th. I have mapped the 4 parameters and in preview mode, everthing works great. In preview mode, the parametrs are passed and the last parameter is left waiting for entry. After deployment, this is not the case. In the deployed state, I simply get an error that parameter #5 is blank. Is there there something I am missing?

regards,

Bill

View 2 Replies View Related

Problem: Must Detect Db Changes

Jul 20, 2005

HelloI´m using MS-SQL Server 2k with a custom application connecting to it.I need a quick and simple way to detect any change (insert, update, delete)to my database (not just to a single table). The purpose is to notifysomehow different instances of the application about the data changes,since they should refresh their local query results.Is there any function, stored procedure, system database entry, etc. I canexploit to get the job done? Can you suggest me the most suitable mechanismto implement this?T.I.A.AndreA

View 1 Replies View Related

How To Detect *.cer Association

May 29, 2007

I am entering to administration of
SS2005 SP1 (Windows 2003) having files mdf, ndf, ldf in
C:Program FilesMicrosoft sql serverMSSQLData
This dir also has two *.cer files.

Apparently no encryption is used


How can I get known what these *.cer files are for?

View 4 Replies View Related

Detect Licensing

Aug 4, 2006

Hello

I am trying to find out if versions of SQL SERVER 2005 we have installed have full or Developer Licenses.

They were installed previously by someone who no longer works here, and we do not the versions on record.

We have enough full licenses, so we just want to make sure the correct ones are set up on our servers.

Anyone know how/where we can find this information?



View 1 Replies View Related

Jump To Report In New Window?

May 11, 2007

Hi all,

Is it possible to use the "jump to report " action and have the report open in a new window?

regards,

Bill

View 3 Replies View Related

Jump From Every Point On A Report

Dec 4, 2007

Hello.

I have a report with a graph in it.

I want to jump to another url when I'm clicking on my report.

I know how to sat the action for clicking inside the report on one of the data number but I want it to jump when I'm ckicking anywhere on the report.

Is there a way to do so?

Thanks.

View 1 Replies View Related

Question About Jump To URL Function

May 19, 2006

Hi !

When using the Jump to URL function, is it possible to open the URL in a new page instance of doing a redirect?

Thanks !

View 9 Replies View Related

How Can I Jump Out Of An Iteration When Using A Cursor?

Jan 24, 2008

Is there a key word one can use to immediately jump out of an iteration when using a cursor, and move to the next record using 'fetch next' cursor?

View 1 Replies View Related

Jump To Report Navigation

Sep 11, 2007



Can I have a report that is nothing more than a parameter and when the user selects from the list it will jump to another report based on which parameter was selected?

I can create a report with a text box that I can click to jump. I'd like to be able to eliminate the click on text box if possible and jump directly from parameter select pull down box.


Thanks.

View 3 Replies View Related

Jump To Bookmark In Reports

Aug 17, 2007

Hi,


Please tell me how to implement the "Jump to Bookmark" in reports,
I mean to say, i have to move to another area or page in a report.
Please provide a sample for the same.


Thanks and Regards
Altaf Nizamuddin

View 1 Replies View Related

Hyperlink:Jump To Report

Mar 14, 2008

Hi,

I have a report that uses Jump to Report and passes Reportname with parameter. Is
there a way to suppress the parameter value in the URL so the user is unable
to manipulate the parameter and execute the changed URL?

This is what I have so far..

="http://<servername>/ReportServer?/<folder>/<reportname>&<parametername>="+Fields!<fieldname>.Value.tostring

because when reports exported to excel, hyperlink path will be displayed and should not display to the user.


Or can we set Hyperline action dyamically?



Thank you.
RSUser

View 4 Replies View Related

Jump To Report With Parameters

Dec 7, 2007

Hello,

I have a report (Report1) with a subreport (SubReport2). The subreport is a barchart. On the data values for the chart, I have a "Jump to Report" action defined. This jumps to another report(Report3) that has some parameters on it. Neither Report 1 nor SubReport2 have any parameters, only Report3.

When I jump to Report3, I would like to have it open up blank with the parameters open to be selected. I don't want to pass in any parameters as I jump to it. This works perfectly when I test it in my Preview pane in BIDS. However, when I upload the report to the ReportServer, when I click on SubReport2 to jump to Report3, I get an error saying

The 'Months' parameter is missing a value

There is no parameter pane for me to choose the parameters (or any other report viewer pane). However, if I open Report3 directly without trying to use Report1 and SubReport2 to jump to it, the parameter pane is there, everything works right.

Does anyone know how I can get the parameters pane to show up when I jump to Report3?

Thanks,
Andy

View 1 Replies View Related

Jump To URL With A New Target _blank

Mar 10, 2007

Hi all,

In Opening a display of invoices in Report Server I have a ULR link in the Jump to URL section under the navigation tab.

html code given : <a href="url" TARGET="_top">my value</a>

I would like have this code html : <a href="url" TARGET="_blank">my value</a>

How can I do it ?

Thanks.

View 1 Replies View Related

Jump To Report Help Needed.

Nov 13, 2007

I am very new to SSRS & SSAS .

Here is my problem. I have a SSRS report that uses a SSAS cube for as it's datasource. I have a drop down parameter box where the user can select a year (2005,2006,2007,etc..) They click the View Report button and the report is generated. On one of the textboxes properties, on the navigation tab I have Jump to Report activated. I select the parameter from the receiving reports with the value of the dropdown box.

What I'm trying to do and can't, is to jump to that report passing the contents of the dropdown box. The receiving report is a SSRS report with a datasource being the SSAS. How do I make the receiving report open based on the parameter that was sent ??

All ideas are welcome...

Thanks ..

View 4 Replies View Related

Report Navigation And Jump Url

Feb 20, 2007

Hi all,

I have got a report with external hyperlink.

When I put this link in TextBox properties >> Navigation >> Jump URL of my gridView : http://www.micheldegremont.com it works.

However, if I put "http://www.micheldegremont.com?id=" + Fields!ID.Value it doesn't work. I haven't not link in my report.

And if I put http://www.micheldegremont.com?id=Fields!ID.Value my report create a hyperlink to http://www.micheldegremont.com?id=Fields!ID.Value and no http://www.micheldegremont.com?id=1

Thanks for you help.

View 2 Replies View Related

Amending Jump To Url Properties?

Dec 7, 2007

Hi

I have a simple report which just lists product details and summary. So somthing like this:

Product Id | Hits | Sales

I want to add a action (Jump To URL) to the Product ID field, which then redirects it to its product page on a website, however, how do I pass the ID field within the url?

for example, typical product page on the website is

www.mysite.com/products/P1234.aspx

I want to do so that I get

www.mysite.com/products/P =Fields!ID.Value .aspx

but obviously that doesnt work!

Anyone have any ideas?

View 6 Replies View Related

Jump To URL With A New Target Page

Feb 6, 2006

In Opening a display of invoices in Report Server I have a ULR link in the Jump to URL section under the navigation tab.

I have the URL with the invoice number in the expression. Is there something I can add to this expression that will force the interface to Open a new windows page instead of the existing window?













View 4 Replies View Related

How Do I Jump To Another Report Based On A Value

May 3, 2007

How do I jump to another report based on a value in my current report?

View 5 Replies View Related

Java Script On The Jump To URL

Jan 4, 2007

Hi, folks,

Does anybody know how to make java script work on the Jump to URL

View 2 Replies View Related

Going Back After Jump To Report

Dec 6, 2007

Hi,

I jumped from one report to enter (useing the "jump to report" option).
How can I go back to the first report?

I tried with the "backspace" button and I tried useing "javascript:history(-1)".

Thanks

View 6 Replies View Related

How To Detect NULL In SQL-table With VB.net ?

Oct 29, 2005

Hi,I want to check with VB.net whether a field in a SQL-table is NULL or not.This code doesnot work:If xxx = NULL then<statements>End IfI got the error, that NULL is not supported ?How do I code the check ???Help is appreciated, Gr.

View 2 Replies View Related

Why Bcp Cannot Detect Temporary Table ?

Jul 22, 2006

hi, good day, i facing a problem


Code:


CREATE PROCEDURE [SP_TEST]

AS

SELECT *
INTO #TMP_CUSTOMER
FROM O_CUSTOMER

-------------------------------------------------------------------------
SELECT DISTINCT
COUNT(CUST_CD)

FROM
#TMP_CUSTOMER
GO




when i run in query analyzer , using "exec SP_TEST" , it work and display result

but when run
Exec Master..xp_CmdShell 'bcp "exec mydbtest..SP_TEST " queryout C:TEST.TXT -c -Slocalhost -Usa -Ppassword'

it give error "SQLState = S0002, NativeError = 208"
and show
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name '#TMP_CUSTOMER'.


thanks for guidance

View 4 Replies View Related

Detect And Or Delete Dups

Oct 30, 2002

Hassle free locating / reporting or deletion of duplicate rows in a SQL table based on the uniqueness of a column or columns that the user provides with a few nifty hands off features. Keywords: delete unique column record records

(This code may also be viewed at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=576&lngWId=5


/*Description: UTILITY - Locate in MASTER


Syntax: EXEC sp_RemoveDups TableName, DupQualifierFieldNameList, DeleteDups, UniqueColName, CreateIdentColIfNeeded, StoredProcedureResult
Only the first two arguments are required
For HELP, enter the stored procedures name without any arguments or see the PRINT statements below
NO DELETION WILL OCCUR by default - only duplicate recordset returned. To delete records, pass in a 0 for the DeleteDups argument.

Example: EXEC sp_RemoveDups 'MyTable','LastName,FirstName,HomePhone'

Purpose: Allow removal of duplicate rows where
1. We define what fields qualify the duplicate
2. We select the unique rowid or it is detected automatically else no action takes place

Method:Delete by RowID all duplicate rows except the highest RowID (in alpha-sort sequence)
of each group of duplicates.

DATEBYCHANGE
09-23-2002FrankOriginal v1.0
09-23-2002FrankChanged the name from sp_RemoveDupsByRowID to sp_RemoveDups
10-8-2002Sean P. O. MacCath-MoranMade @UniqueColName optional
Added logic to auto-detect RowGUID and Identity columns
Added logic to check for unique value column if no RowGUID or Identity column exists
Added logic to create a temporary ID field as a last resort if no unique column could be located
Added HELP

*/

CREATE PROCEDURE sp_RemoveDups
@TableName as varchar(50) = NULL,
@DupQualifierFieldNameList as varchar(200) = NULL,
@DeleteDups as bit = NULL,
@UniqueColName as varchar(50) = NULL,
@CreateIdentColIfNeeded as bit = NULL,
@StoredProcedureResult int = NULL OUTPUT

AS
SET NOCOUNT ON

DECLARE @SQL nvarchar(2000)
DECLARE @SQL_DetermineUniqueTemplate nvarchar(2000)
DECLARE @TempIdentColName varchar(20)
DECLARE @HostName varchar(50)
DECLARE @ActionText varchar(10)

DECLARE @SUM int
DECLARE @COUNT int
DECLARE @NextColumn varchar(50)


/*==================================================================================*/
/*========================VARIABLE INITIALIZATION AND SETUP========================*/
/*=================================================================================*/
/*If no unique column is located then a temporary Identity column will be created useing the name specified in this TempIdentColName string*/
SET @TempIdentColName = 'TempIdentityColXY123'

SET @SQL_DetermineUniqueTemplate = 'SELECT @COUNT = COUNT(Count), @SUM = sum(Count) from '
SET @SQL_DetermineUniqueTemplate = @SQL_DetermineUniqueTemplate + CHAR(13) + '(SELECT TOP 100 PERCENT <COLUMN_NAME>, COUNT(*) as Count FROM ' + @TableName
SET @SQL_DetermineUniqueTemplate = @SQL_DetermineUniqueTemplate + CHAR(13) + ' GROUP BY <COLUMN_NAME> ORDER BY <COLUMN_NAME>) a'

/*Retrieve the Host Name. This will be used later in this SP as a test to determine if the user is making this call from within SQL Query Analyzer*/
SELECT @HostName = hostname FROM master..sysprocesses WHERE spid = @@SPID AND program_name = 'SQL Query Analyzer'


/*Set ActionText to be used in message output*/
IF (@DeleteDups IS NULL) OR (@DeleteDups = 1)
SET @ActionText = 'Selection'
ELSE
SET @ActionText = 'Deletion'

/*If a value is specified for use by UniqueColName it cannot exist in the columns from the DupQualifierFieldNameList*/
IF CHARINDEX(@UniqueColName, @DupQualifierFieldNameList) > 0
BEGIN
/*The value in UniqueColName was detected in DupQualifierFieldNameList.*/
IF NOT (@HostName IS NULL) PRINT 'The UniqueColName provided (' + @UniqueColName + ') must not exist in DupQualifierFieldNameList (' + @DupQualifierFieldNameList + '). Other solutions will be sought automatically.'
SET @UniqueColName = NULL
END


/*If UniqueColName is provided then perform check to ensure that all the values in that column are, in fact, unique.*/
IF NOT (@UniqueColName IS NULL)
BEGIN
SET @SQL = REPLACE(@SQL_DetermineUniqueTemplate,'<COLUMN_NAME>', @UniqueColName)
/*Perform a check of this column to determine if all of it's values are unique*/
EXEC sp_executesql @SQL, N'@SUM as int OUTPUT,@COUNT as int OUTPUT',@SUM OUTPUT,@COUNT OUTPUT
/*Test to determine if this column contains unique values*/
If @SUM <> @COUNT
BEGIN
/*The column specified by UniqueColName does not contain unique values.*/
IF NOT (@HostName IS NULL) PRINT 'The UniqueColName provided (' + @UniqueColName + ') does not contain unique values. Other solutions will be sought automatically.'
SET @UniqueColName = NULL
END
END


/*==============================================================*/
/*======================HELP OUTPUT TEXT======================*/
/*==============================================================*/
IF (@TableName IS NULL) OR (@TableName = '/?') OR (@TableName = '?') OR (@DupQualifierFieldNameList IS NULL) OR (@DupQualifierFieldNameList = '/?') OR (@DupQualifierFieldNameList = '?')
BEGIN
IF NOT (@HostName IS NULL)
BEGIN
PRINT 'sp_RemoveDups ''TableName'', ''DupQualifierFieldNameList'', [''DeleteDups''], [''UniqueColName''], [''CreateIdentColIfNeeded''], <''StoredProcedureResult''>'
PRINT '====================================================================================================================================================================='
PRINT 'TableName: Required - String - Name of the table to detect duplicate records in.'
PRINT 'DupQualifierFieldNameList: Required - String - Comma seperated list of columns that make up the unique record within TableName.'
PRINT 'DeleteDups: Optional - Bit, Set to 0 to delete duplicate records. A value of NULL or 1 will return the duplicate records to be deleted.'
PRINT 'UniqueColName: Optional - Bit - A table must have a unique column value in it to perform the deletion logic. If no UniqueColName is provided then an attemp will be made to locate the RowGUID column. If that fails then an attempt will be made to locate the Identity column. If that fails then all of the columns of the table will be examined and the first one with all unique values will be selected.'
PRINT 'CreateIdentColIfNeeded: Optional - Bit - By default this SP will create an identity column if no unique column can be located. Pass in a 1 here to run this feature off.'
PRINT 'StoredProcedureResult: Optional - OUTPUT - Int - Returns a 3 if an error occured, otherwise returns a 0.'
END
SET @StoredProcedureResult = 3
RETURN
END


/*========================================================================*/
/*======================DETECT USABLE UniqueColName======================*/
/*========================================================================*/
IF @UniqueColName IS NULL
BEGIN
/*Check for a RowGUID or Identity column in this table. If one exists, then utilze it as the unique value for the purposes of this deletion*/
IF EXISTS(SELECT * FROM SysColumns WHERE ID = Object_ID(@TableName) and ColumnProperty(ID,Name,'IsRowGUIDCol') = 1) SET @UniqueColName = 'RowGUIDCol'
IF EXISTS(SELECT * FROM SysColumns WHERE ID = Object_ID(@TableName) and ColumnProperty(ID,Name,'IsIdentity') = 1) SET @UniqueColName = 'IdentityCol'

IF @UniqueColName IS NULL
/*If no RowGUID or Identity column was found then check all of the columns in this table to see if one of them can be utilized as a unique value column*/
BEGIN
/*Select all of the columns from the table in question...*/
DECLARE MyCursor CURSOR LOCAL SCROLL STATIC FOR SELECT name FROM syscolumns WHERE OBJECT_ID(@TableName)=ID

OPEN MyCursor
FETCH NEXT FROM MyCursor INTO @NextColumn
WHILE @@fetch_status = 0
BEGIN
/*Create SQL string with correct column name in place.*/
SET @SQL = REPLACE(@SQL_DetermineUniqueTemplate,'<COLUMN_NAME>', @NextColumn)
/*Perform a check of this column to determine if all of it's values are unique*/
EXEC sp_executesql @SQL, N'@SUM as int OUTPUT,@COUNT as int OUTPUT',@SUM OUTPUT,@COUNT OUTPUT
/*Test to determine if this column contains unique values*/
If @SUM = @COUNT
BEGIN
/*A unique values column is detected. Use it and break out of the loop UNLESS column is specified in DupQualifierFieldNameList*/
IF CHARINDEX(@NextColumn, @DupQualifierFieldNameList) = 0
BEGIN
/*NextColumn was NOT detected in DupQualifierFieldNameList, so this is the column we will use.*/
SET @UniqueColName = @NextColumn
BREAK
END
END
ELSE
FETCH NEXT FROM MyCursor INTO @NextColumn
END
CLOSE MyCursor
DEALLOCATE MyCursor

END
END

/*If no UniqueColName has been found then create one UNLESS @CreateIdentColIfNeeded = 1*/
IF (@UniqueColName IS NULL) AND ( (@CreateIdentColIfNeeded IS NULL) OR (@CreateIdentColIfNeeded = 0) )
BEGIN
/*Add a sequence column to the table...*/
IF NOT (@HostName IS NULL) PRINT 'Creating temporary identity column in the ' + @TableName + ' table named ' + @TempIdentColName + ' for use in this ' + LOWER(@ActionText) + ' process...'
EXEC('ALTER TABLE ' + @TableName + ' ADD ' + @TempIdentColName + ' [int] IDENTITY (1, 1)')
SET @UniqueColName = @TempIdentColName
END


/*============================================================================*/
/*======================EXECUTE DELETION OR SELECTION======================*/
/*===========================================================================*/
IF @UniqueColName IS NULL
BEGIN
/*No UniqueColName was provided by the user and none were detected by the script. This deletion algorythm cannot run.*/
IF NOT (@HostName IS NULL) PRINT 'Could not perform ' + LOWER(@ActionText) + ' process. No unique columns were located and the UniqueColName flag is set to 1 (False).'
SET @StoredProcedureResult = 3
RETURN
END
ELSE
BEGIN
IF NOT (@HostName IS NULL) PRINT 'Performing ' + LOWER(@ActionText) + ' utilizing the unique values in the ' + @UniqueColName + ' column as a reference...'
/*
Create and execute an SQL statement in the form of:

SELECT * (or DELETE)
FROM TableName WHERE UniqueColName IN
(
SELECT UniqueColName FROM TableName WHERE UniqueColName NOT IN
(
SELECT MAX(Cast(UniqueColName AS varchar(36))) FROM TableName GROUP BY DupQualifierFieldNameList, DupQualifierFieldNameList, etc
)
)
*/
/*Delete all duplicate records useing @UniqueColName as a unique ID column */
IF (@DeleteDups IS NULL) OR (@DeleteDups = 1)
SET @SQL = 'SELECT * '
ELSE
SET @SQL = 'DELETE '

SET @SQL = @SQL + 'FROM ' + @TableName + ' WHERE ' + @UniqueColName + ' IN '
SET @SQL = @SQL + CHAR(13) + CHAR(9) + '(' + CHAR(13) + CHAR(9)
SET @SQL = @SQL + 'SELECT ' + @UniqueColName + ' FROM ' + @TableName + ' WHERE ' + @UniqueColName + ' NOT IN '
SET @SQL = @SQL + CHAR(13) + CHAR(9) + CHAR(9) + '(' + CHAR(13) + CHAR(9)+CHAR(9)
SET @SQL = @SQL + 'SELECT MAX(Cast(' + @UniqueColName + ' AS varchar(36))) FROM '
SET @SQL = @SQL + @TableName + ' GROUP BY ' + @DupQualifierFieldNameList
SET @SQL = @SQL + CHAR(13) + CHAR(9) + CHAR(9) + ')' + CHAR(13) + CHAR(9) + ')'

EXEC (@SQL)
IF @@ERROR <> 0
BEGIN
IF NOT (@HostName IS NULL) PRINT @ActionText + ' process failed.'
SET @StoredProcedureResult = 3
END
ELSE
BEGIN
IF NOT (@HostName IS NULL) PRINT @ActionText + ' completed successfully with this SQL: ' + CHAR(13) + @SQL
SET @StoredProcedureResult = 0
END
END


IF (@UniqueColName = @TempIdentColName) AND ( (@CreateIdentColIfNeeded IS NULL) OR (@CreateIdentColIfNeeded = 0) )
BEGIN
/*Remove the sequence column from the table...*/
IF NOT (@HostName IS NULL) PRINT 'Removing temporary identity column named ' + @TempIdentColName + ' from the ' + @TableName + ' table...'
EXEC('ALTER TABLE ' + @TableName + ' DROP COLUMN ' + @TempIdentColName)
END
GO







Edited by - emanaton on 10/30/2002 11:28:34

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved