Karuta’s ASP & M$ SQLserver

Dicas, códigos e outras coisinhas de meus estudos para não esquecer…

Archive for setembro \30\UTC 2012

JS para confirmar um HREF

Posted by karuta em setembro 30, 2012

Use a javascript confirm box to ask the user if they want to delete

<script>
function confirmDelete(delUrl) {
if (confirm(“Are you sure you want to delete”)) {
document.location = delUrl;
}
}
</script>

<a href=“javascript:confirmDelete(‘delete.page?id=1’)”>Delete</a>

Another way

<a href=“delete.page?id=1” onclick=“return confirm(‘Are you sure you want to delete?’)”>Delete</a>

Anúncios

Posted in javascript | Leave a Comment »

SQL SERVER – Upper Case Shortcut SQL Server Management Studio

Posted by karuta em setembro 29, 2012

Few days ago, I received code which is very similar to code shown below.
select *
from Sales.SalesOrderDetail
where ProductID > 777

I am not the guy who go crazy for formatting but I do appreciate proper coding. I like if the code was formatted like below.

SELECT *
FROM Sales.SalesOrderDetail
WHERE ProductID > 777

The fastest way one can do this in SSMS is either search and replace or using SSMS short cut to covert keywords to upper case.

What I do is I select the word and hit CTRL+SHIFT+U and it SSMS immediately changes the case of the selected word. Similar way if one want to convert cases to lower case, another short cut CTRL+SHIFT+L is also available.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Posted in sql server, store procedure | Leave a Comment »