Hi experts,
I m new in SQL stuff. I have to work out a fucntion with ASP.net for CSV import to the DB in MSSQL.
I would like to know for Stored Proc, is there any way that I can do the case conversion?
e.g
the Full_Name read from CSV file: Lennon, John
Then for the family name I need to convert into uppercase so the converted one: LENNON, John
Is there any way I can check those words before the comma? The CSV file is delimited with | instead of , ?
Can I use substring for that? And also do you have any online tutorial for Stored Procedure recommended? Thanks a lot!!!
Cheers,
KNVB
Hi,
Here is an example:
declare @.fullName varchar(100)
set @.fullName = 'Lennon, John'
select upper(left(@.fullName, charindex(',', @.fullName) - 1)) + right(@.fullName, len(@.fullName) - charindex(',', @.fullName) + 1)
Note: The first two lines of code are just for the sample
It might be better to implement this as a FUNCTION in case of a STORED PROCEDURE since functions can be used in your select statement.
References:
Creating stored procedures: http://www.sql-server-performance.com/tn_stored_procedures.asp|||
Merci beaucoup, Geert!
By the way, have you heard of a company called i4net from Namur?
|||No problem, glad to help.
I didn’t know i4net. Is this your company maybe?
Greetz,
Geert
No comments:
Post a Comment