Wednesday 5 March 2008

Converting HTML to aspx tip

I need to convert some html to aspx. On the page were loads of images and as i moving stuff into master pages it was going to totally scre the directories up.

As you may know with a server control you can use the sqiggle/tilda (~) in a path so the server resolves the actual path for you when it generated the page.

What you can do to save a lot of time is rather than change all the image controls, for example, is just add a runat="server" to the html control and then do a search and replace on the image url to add the ~. This allows the existing alt text etc to be used without having to convert to a server control - which has different naming conventions for the attributes.

Find out what stored procs have changed

Been ages since ive posted on here as ive been in a cave working on a big project! Ive finally come out and found time to post something useful i found.

I wanted to know what had changed in a database in the last x days to check for things before i did a backup/restore so found the following queries useful!

This fella will tell you the stored procedures that have been modified in the last x days:

SELECT NAME ProcName, create_date Created, modify_date Modified
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 3 --Change 7 to any other day value
ORDER BY 3 DESC

This fella will tell you the stored procedures that have been created in the last x days:

SELECT NAME ProcName, create_date Created, modify_date Modified
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,create_date, GETDATE()) < 3
ORDER BY 2 DESC

Very handy!