NVARCHAR - to be used because if 100 characters are set aka NVARCHAR(100), but only 10 characters are used the amount of space used is 10.
WHERE if NCHAR 100 Characters aka NCHAR(100) , but only 10 characters are used the amount of space used is 100...
Very wasteful on data storage. "KNOW YOU YOUR DATA", as Larry Leonard would say.
This blog is about my history as a software engineer utilizing technologies C#, Java, React, JavaScript, .NET Core, SQL Server , Oracle, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison. Please click on all my ADVERTISING links to help support this blog. Thank you.
Friday, February 22, 2013
Visual Studio Build Feature
GREAT POST --- http://geeks-squad.blogspot.com/2008/07/what-does-clean-solution-under-build.html
What does "Clean Solution" under Build Menu in Visual Studio do ?
I have been using the Visual Studio 2003 and 2008 IDE everyday at work for 9 hours for almost 7 months now and still keep running into these little stuff in the IDE that either I never thought existed or seen or even if I have seen never bothered to explore further.
So, today morning, while building my project, (I usually use Ctrl+Shift+B (Build All) rather than go to the Build Menu and use the Build Solution there) from the Build Menu, I saw the Clean Solution menu that I always knew existed but never bothered to find out what for.
So, I decided to look it up on MSDN and this is what I found.
So, today morning, while building my project, (I usually use Ctrl+Shift+B (Build All) rather than go to the Build Menu and use the Build Solution there) from the Build Menu, I saw the Clean Solution menu that I always knew existed but never bothered to find out what for.
So, I decided to look it up on MSDN and this is what I found.
To build, rebuild, or clean an entire solution
In Solution Explorer, select or open the desired solution. On the Build menu, choose Build Solution, Rebuild Solution, or Clean Solution.
Choose Build or Build Solution to compile only those project files and components that have changed since the last build.
Note: The Build command becomes Build Solution when a solution includes more than one project. Choose Rebuild Solution to "clean" the solution first, and then build all project files and components. Choose Clean Solution to delete any intermediate and output files, leaving only the project and component files, from which new instances of the intermediate and output files can then be built.
So, Clean Solution apparently cleans up ur .pdb files from the solution directory and adds them back again when you build the solution again with the new component files and the output generated by them.
Another article that explain "Clean Solution" can be found here.
But then again, my curiosity did not die there, so I continued on trying to find what exactly goes on in a "pdb" file and found some really good articles.
MSDN says
"A program database (PDB) file holds debugging and project state information that allows incremental linking of a debug configuration of your program. A PDB file is created when you build with /debug (Visual Basic/C#). You can build Visual Basic and Visual C# applications with/debug:full or /debug:pdbonly. Building with /debug:full generates debuggable code. Building with /debug:pdbonly generates PDBs but does not generate the DebuggableAttribute that tells the JIT compiler that debug information is available. Use /debug:pdbonly if you want to generate PDBs for a release build that you do not want to be debuggable.
The Visual Studio debugger uses the path to the PDB in the EXE or DLL file to find the project.pdb file. If the debugger cannot find the PDB file at that location, or if the path is invalid, for example, if the project was moved to another computer, the debugger searches the path containing the EXE followed by the symbol paths specified in the Options dialog box. This path is generally the Debugging folder in the Symbols node. The debugger will not load a PDB that does not match the binary being debugged."
Edition
|
Visual
Basic
|
C#
|
C++
|
Web Developer
|
---|---|---|---|---|
Express
| ||||
Standard
| ||||
Pro and Team
|
Table legend:
Applies
| |
Does not apply
| |
Command or commands hidden by default.
|
Other findings :
"The dll is the actual binary that executes. The PDB is the symbols that map memory locations in the binary to symbolic names for the debugger."
Anyways, that's it from me as far as pdb and "Clean Solution" is concerned. Next time will talk about Generics (one of my favorite features in C#).
Until next time,
Happy Debugging !!!
Thursday, February 21, 2013
New Job Title
Trained chimp behind the key board LOL... I heard that from a co-worker today and thought that was funny.
T-SQL Cursor example
--------------------------CURSOR CODE BEGIN------------------------------
DECLARE @id INT
DECLARE @doc_id INT
DECLARE @review_count INT
DECLARE MyCursor CURSOR FAST_FORWARD FOR
SELECT
doc_id,
SUBSTRING(short_desc, 6, 6) AS id
FROM tbl_client_doc cd
WHERE
cd.doc_type_id = 18
AND
cd.short_desc LIKE "XYZ: %'
AND
cd.note_desc = ''
ORDER BY
cd.doc_type_id DESC
OPEN TarCursor
FETCH NEXT FROM MyCursor INTO @doc_id, @id
WHILE @@FETCH_STATUS = 0
BEGIN
SET @review_count = (SELECT COUNT(answer_id) FROM tbl_review_gen WHERE id = @id)
IF @review_count > 0
BEGIN
PRINT 'DELETE FROM tbl_client_doc WHERE doc_id = ' + CONVERT(varchar(10), @doc_id)
END
FETCH NEXT FROM MyCursor INTO @doc_id, @id ---- Have to move to the next row
END
--CLOSE MyCusor
DEALLOCATE MyCursor
GO
--------------------------CURSOR CODE END-------------------------------
Tuesday, February 19, 2013
DropDownList set dl.SelectedValue
Private Sub dg_srvc_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg_srvc.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem Then
Dim dl_span As DropDownList
Dim t As Label
dl_span = CType(e.Item.FindControl("dl_span"), DropDownList)
dl_span.SelectedValue = dl_span.Items.IndexOf(dl_span.Items.FindByText(s_span.Trim.ToLower))
t = CType(e.Item.FindControl("temp"), Label)
t.Text = s_span.Trim
End If
WARNING: ENSURE your values if hard coded match the value from the DB...
Visual Studio Windows opening in different Window Panes?
If your Visual Studio 2012 or any other version is opening Windows in different panes try the following:
File Menu
--- Window
---- Reset Window Layout
Pretty good stuff --- Also found "Auto Hide All" good shortcut to get the full screen to code with.
Friday, February 15, 2013
Databinding
MSDN - Data-binding expressions are contained within <%# and %> delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.
Search for Text in SQL Server DB
use DB_NAME
SELECT DISTINCT
DB_NAME() AS DatabaseName,
OBJECT_SCHEMA_NAME(id) AS SchemaName,
OBJECT_NAME(id) AS ObjectName,
SUBSTRING(text, PATINDEX('%YOUR_SEARCH_TEXT%',text) - 10, 100) AS TextLocation
FROM sys.syscomments
WHERE text LIKE '%YOUR_SEARCH_TEXT%'
ORDER BY 1, 2, 3
Tuesday, February 12, 2013
SQL Server Check --- IF Exists
IF EXISTS(SELECT * FROM tempdb.dbo.sysobjects WHERE ID = OBJECT_ID(N'tempdb..#temp_det_for_mst'))
BEGIN
DROP TABLE #temp_det_for_mst
END
Tuesday, February 05, 2013
Entity Framework (Credit Walt Daniels)
Wiring up Entity Framework to DropDownList ASP.NET.
Prereq --- Setup Entity Framework.
Private Sub FillSource()
ctx = New Context()
Dim qry = From p In ctx.tbl_names
Where p.ACTIVE = True
Order By p.name
Select p.id, p.name
ddlFundSource.DataSource = qry.ToList()
ddlFundSource.DataValueField = id"
ddlFundSource.DataTextField = "name"
ddlFundSource.DataBind()
ddlFundSource.Items.Insert(0, New ListItem("[Any Fund]", "0")) ' Tip if you want to add a default value.
End Sub
Prereq --- Setup Entity Framework.
Private Sub FillSource()
ctx = New Context()
Dim qry = From p In ctx.tbl_names
Where p.ACTIVE = True
Order By p.name
Select p.id, p.name
ddlFundSource.DataSource = qry.ToList()
ddlFundSource.DataValueField = id"
ddlFundSource.DataTextField = "name"
ddlFundSource.DataBind()
ddlFundSource.Items.Insert(0, New ListItem("[Any Fund]", "0")) ' Tip if you want to add a default value.
End Sub
Subscribe to:
Posts (Atom)