After replying to a post today I thought I'd share this with all.
This is a user defined function that I use to return a table of parameters passed in a parameter string.
Function Usage
Select * From dbo.fnParseParamString ([@ParamString='Delimited String of parmaters'],[@Delimeter='Delimiting Character'])
Lets say you are concatenating a list of form data from a web page where you take the user's First Name, Last Name and email address.
your concatenated string looks like this: John,Doe,jdoe@company.com
Once you've installed the userdefined function you can execute this:
select * from dbo.fnParseParamString('John,Doe,jdoe@company.com',',')
this returns
iRowId vcParameters
----------- --------------------
1 John
2 Doe
3 jdoe@company.com
(3 row(s) affected)
now, since you know Parameter 1 is the first name, and parameter 2 is the last name and parameter 3 is the email address you can do something like this:
select vcParameter from dbo.fnParseParamString('John,Doe,jdoe@company.com',',') where iRowId = 3
which returns the email address portion of the parameter string
vcParameters
--------------------
jdoe@company.com
(1 row(s) affected)
A Normalization Primer
For most DBAs, normalization is an understood concept, a bread and butter bit of knowledge. However, it is not at all unusual to review a database design by a development group for an OLTP (OnLine Transaction Processing) environment and find that the schema chosen is anything but properly normalized. This article by Brian Kelley will give you the core knowledge to data model.
2003-01-13
18,597 reads