March 2004 - Posts

COME ON WEEKEND !!!

COME ON WEEKEND !!!

Just a small sql script for Brett ...


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[udf_Time_to_Weekend]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[udf_Time_to_Weekend]
GO


Create  function udf_Time_to_Weekend (@d1 datetime) returns datetime
as
begin
declare @d2 datetime
select @d2 =  case when (datepart(hh,dateadd(dd,(7-datepart(dw,@d1)),@d1)) >= 17 and 7-datepart(dw,@d1) = 0)
then   dateadd(hh,17,convert(varchar(10),dateadd(dd,7,@d1
),101))
else dateadd(hh,17,convert(varchar(10),dateadd
(dd,(7-datepart(dw,@d1)),@d1),101))
end
return  @D2
END


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[HoursTillMargaritaville]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[HoursTillMargaritaville]
GO



create  procedure HoursTillMargaritaville as
set datefirst 6
select DATEDIFF(MI,GETDATE(),dbo.udf_Time_to_Weekend(getdate()))/60 "Hours Till Margaritaville"

GO

exec HoursTillMargaritaville


 

Worst naming practices in SQL

byrmol talks about having to cope with a column with “*“ in its name ... the worst case of column naming he's ever seen.

And I have seen a table with the name TEST. Believe me ... it was the most important table of the database.

People do not understand fractions

Just saw this on the back of a vehicle on the way back from work ....

"7/5 of all people do not understand fractions."

Funny .. eh !!!

Clustered Index frustrating me

SQL Server - Clustered Index frustrating me


create clustered index AOP_C_Idx on AOP_Master([Date])
Running this query gives the error :

Server: Msg 169, Level 15, State 2, Line 2
A column has been specified more than once in the order by list. Columns in the order by list must be unique.

However I do not have any other indexes on the table. The table has already been created an contains valid data. What could be the problem ???

SQL Server Notification Services

This is what I am working on right now .... can anyone guide me to resources where I can know how to send notifications to a PDA, through IM or by SMS .... am able to do it only through mail till now :(

How does Scoble manage his web logs ????

Personal Thoughts : Unmanageable web logs

Two days away from the web and I have got a whopping 375 pages of blogs to read. And I have not subscribed to as many blogs as Scoble. How does he manage his web logs ... maybe some tips would help.

Run as Administrator

Personal Thoughts : A great tip for windows

Ever felt the need to run a particular SW as an administrator or any other user while being logged on as a normal user ??? 

If the answer is YES then here is the solution.

You can simply type in the following command which will do the trick ... You can use this in a shortcut or ... Start : Run

%windir%\system32\runas.exe /user:domain\username “SW path”

eg. %windir%\system32\runas.exe /user:mbahl\Administrator “c:\Program Files\Internet Explorer\iexplore.exe”

 

A Day at the Microsoft Office, Mumbai (India)

Well ... was busy all day today attending a training session on MSIB 2.1 (Microsoft Internet Business) , a tool that integrates the MS Commerce Server and MS Content Management Server. The training was taken by Henry Winkler from MS.

The guy is a great speaker, and it was one of the best training sessions I have attended (I dozed off only once, and that too in the middle of a lengthy discussion about .NET, of which I was not understanding even one word.)

Will be continuing tomorrow ... and will post more about any interesting things I find out. Today was just the introduction for the SW and a few hands on sessions to get us aquainted with the product.  

Edit : I have been receiving a lot of hits from google on this post for “Microsoft Office Mumbai”,“Microsoft India Office”, “Microsoft Mumbai” and the same. So for all the users searching for MS addresses, you can find them here ..

http://www.microsoft.com/india/address.aspx

SQL Server needs a Spell Check

SQL Server - Spell Check Needed

Just saw this while debugging a procedure ...Something I thought I should share :)

 

Sql Server Yukon

SQL Server - Yukon

Its been a long time since I ve been trying to get my hands on a SQL Server Yukon Beta but it has eluded me so far ... I am mentioning it here just in case someone would tell me the right way to get a copy of it ...

Connecting Via Query Analyzer

Josh Crosby talks about using a (.) to connect to the local server from QA ... that's cool ... I didnt know that ... 

Till Now my fav method was to create shortcuts to directly log in to my production and dev servers. 

For those who want to know how it could be done

Right Click --> Select New Shortcut -->

In The location box type in

isqlw -S Servername -D dbname -U userid -P password

or   isqlw -S Servername -D dbname -E

if you use integrated authentication.

May be I am just lazier than Josh :)

Force all ye devs to do this correctly :)

SQL Server - Amusing

Just found this comment from one of the Installation scripts for SQL Server 2000.

Procsyst.sql ... Line 15


set quoted_identifier on -- Force all ye devs to do this correctly!


 

Non Logged Events - SQL Server

SQL Server - Non logged Events

http://www.google.com/search?hl=en&lr=&ie=utf-8&oe=utf-8&q=non+logged+events+sql+server

Another Day, another Beer :). Better than MS on Google!!!! Thats definitely another reason to celebrate

Custom Skin for .TEXT

.Net - Beginner's Story

Just downloaded the .Text Code and got it running on my IIS ... plan to create a new custom skin for .Text (need some variety .. all the sites using .Text are using the same skins) . Wait and see what happens ... coz I am not exactly a .NET developer (I mean .. I have practically no experience in .NET programming ... I am a DBA). Will blog about my experiences in due course as to how it progresses (I believe it will be quite amusing for all you guys, to hear about my experiences learning the language from scratch (without any of those Learn .Net in 21 days books).

Also would appreciate comments on what books would be helpful to me  (Beginner Level)

The SQL Apostle

Personal Thoughts : The SQL Apostle

Following this post by Scoble, I casually checked the status of my Blog title “The SQL Apostle” on google ... and it was #2 on the list.

The #1 also belongs to me , but from a different site (www.dbforums.com/f7). So I guess I should have a beer to celebrate this one :) .