.NET: Naming convention for a column with "AS" in stored procedure

  • Thread starter Thread starter Fir5tSight
  • Start date Start date
F

Fir5tSight

Hi,

I have a stored procedure that looks like the follows:

-------------------------------------------------------------------------------------
SELECT
ClientName AS 'Client Name',
Location,
ReportInstanceID
FROM
#CORE
-------------------------------------------------------------------------------------

I want to add the stored procedure to my C# code manually as a typed
DataTable. Obviously I'll need to add data columns for the three
columns in the SELECT statement.

Question: Shall I use "ClientName" or "Client_Name" for the first
column? What's the naming convention in .NET for the column names with
"AS" in the stored procedure?

Thanks!

-Emily
 
I would avoid column names with spaces in them like I would a
police officer when driving 80mph in a 55mph zone. They will
haunt you, make your life a living hell, require you to use
square brackets around them when you want to use them and
be a pain in the A** that you have to deal with every single
time you want to touch that table. (Not that I'm bitter.)

If you really, really don't want to use ClientName
(which is the recommended standard), use Client_Name. At least
if you do that, and you're using it for column headers somewhere,
you can replace all underscores, and get a workable column header.

Robin S.
 
Hi,

I have a stored procedure that looks like the follows:

-------------------------------------------------------------------------------------
SELECT
ClientName AS 'Client Name',
Location,
ReportInstanceID
FROM
#CORE
-------------------------------------------------------------------------------------

I want to add the stored procedure to my C# code manually as a typed
DataTable. Obviously I'll need to add data columns for the three
columns in the SELECT statement.

Question: Shall I use "ClientName" or "Client_Name" for the first
column? What's the naming convention in .NET for the column names with
"AS" in the stored procedure?

Thanks!

-Emily

Hey Emily,

I think it's up to your personal preference to chose which naming
convention to go. Personally i'd do ClientName, because it's easier to type
:)
 
Back
Top