Showing posts with label supposed. Show all posts
Showing posts with label supposed. Show all posts

Tuesday, March 27, 2012

Easy Update

can someone please enlighten me. why doesn't this work? It is supposed
to remove any periods in the TSUSA_Code field.
UPDATE tblLookupParts
SET TSUSA_Code = REPLACE(TSUSA_Code, '.', '')
thanks
-doodleI am getting: Undefined function 'Replace' in expression.|||Is it because you have a case sensitive collation?
You can find this using Select SERVERPROPERTY('Collation')...
doodle wrote:
> can someone please enlighten me. why doesn't this work? It is supposed
> to remove any periods in the TSUSA_Code field.
> UPDATE tblLookupParts
> SET TSUSA_Code = REPLACE(TSUSA_Code, '.', '')
>
> thanks
> -doodle|||that returns an error also: unable to parse query text|||You are running Microsoft SQL Server, are you not? What version and
service pack level?
Roy
On 20 Oct 2006 15:07:49 -0700, "doodle" <ADraughn@.mazakcorp.com>
wrote:
>can someone please enlighten me. why doesn't this work? It is supposed
>to remove any periods in the TSUSA_Code field.
>UPDATE tblLookupParts
>SET TSUSA_Code = REPLACE(TSUSA_Code, '.', '')
>
>thanks
>-doodle|||I have SQL Server 2005, using Visual Studio 2005 to run my SQL queries
against Access DB tables.
-doodle|||On 21 Oct 2006 05:44:05 -0700, "doodle" <ADraughn@.mazakcorp.com>
wrote:
>I have SQL Server 2005, using Visual Studio 2005 to run my SQL queries
>against Access DB tables.
>-doodle
That explains it. You need to use Access's dialect of SQL. Look for
help in an Access newsgroup.
http://groups.google.com/groups/dir?&sel=33606877&expand=1
Roy Harvey
Beacon Falls, CTsql

Friday, February 24, 2012

Dynamic Text Parser?

Hi Guys,

I have a script task that is supposed to read and parse a fixed width source file.

Basically, I want to make the FieldWidths dynamic so that I'll be able to reuse this package with different files. So Instead of hardcoding the field widths directly into my script task, I want it to be stored somewhere that the package can get when executions starts. Is there a way of doing this?

The code looks like this:

Using Reader As New TextFieldParser(mTempFilePAth)

Reader.TextFieldType = FieldType.FixedWidth

Reader.SetFieldWidths(1, 8, 8, 8, 4, 8) <-- I want to change this to handle dynamic widths.

Hi,

The best way to make your package re-usable is to use a "Integration Services Variable", see this link for help on variables http://msdn2.microsoft.com/en-us/library/ms141085.aspx and this one for accessing from a script http://msdn2.microsoft.com/en-us/library/aa337079.aspx.

The main gotcha is you need to be aware of is this bit from the second link "You can make existing variables available for read-only or read/write

access by your custom script by entering comma-delimited lists of

variables in the ReadOnlyVariables and ReadWriteVariables fields on the Script page of the Script Transformation Editor."

Also does SetFieldWidths take a variable number of arguments? If so you may need to define a string SSIS variable with the arguments comma seperated, then parse them into the seperate arguments for SetFieldWidths

Dave