A date with no time

 

SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
SELECT CONVERT(varchar(8), GETDATE(), 112)

Advertisements

Hitting those break points in Visual Studio

Getting visual studio to hit break points can at time be a little frustrating. It will work for months on end and then decide to not work.  Below are some points to trying to track down where the error is.

IIS 7:
Sites –> –> .Net Compilation –> Behaviour –> Debug = True

ASPX:
<%@ Page Language=”VB” Debug=”true” …. %>
<%@ Page Language=”C#” Debug=”true” …. %>

Attach to process:
Select managed and native code; I get better results than auto.

Third to last resort:
Delete the contents of obj within the dll directory
Delete the contents of the bin directory

Kill w3p.exe and IE <try>

Kill w3p.exe and IE, VS, restart IIS

Second to last resort the modules window
Debug –> Windows –> Modules
Check the synbol status of your dll

If not loaded highlight the required dll.
Modules Window –> Load symbols from –> Symbol Path

Last resort
<I have not had to get quite this desperate yet!>
Tools –> Options –> Debugging –> Symbols
Play with symbol locations and also the symbols cach.

Query the SQL Server Schemea

 

— query via information scheme
use <dbname>
GO;

SELECT top 10 * FROM INFORMATION_SCHEMA.TABLES
select top 10 * from INFORMATION_SCHEMA.VIEWS
SELECT top 10 * FROM INFORMATION_SCHEMA.COLUMNS
select top 10 * from INFORMATION_SCHEMA.PARAMETERS
select top 10 * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
select top 10 * from INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE

— sys.objects
use <dbname>
GO;

select top 10 * from <dbname..sys.procedures
select top 10 * from <dbname>sys.tables
select top 10 * from <dbname>sys.columns
select top 10 * from <dbname>sys.views

— object definition
use <dbname>
GO;

SELECT name, OBJECT_DEFINITION(OBJECT_ID), *
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%foo%’

— sysobjects/syscolumns
use <dbname>
GO;

SELECT objParent.name AS parent, obj.name
FROM sysobjects obj
LEFT JOIN syscolumns col
ON obj.id = col.id
LEFT JOIN sysobjects objParent
ON objParent.id = obj.parent_obj
WHERE col.name LIKE ‘%foo%’
OR obj.name LIKE ‘%foo%’