April 13, 2002

Format the Given Date into a Required Date Format

You can change the given format into the required date format using the CONVERT Function. Here’s an example: companyid peo———– ———–104 1998-09-30104 1999-09-30104 1999-12-31104 2000-03-31104 2000-06-30104 2000-09-30104 2000-12-31104 2001-03-31104 2001-06-30104 2001-09-30(10 row(s) affected)’///////////////////////////////////select distinct companyid ,CONVERT(char(10) , peo ,101) Style1,CONVERT(char(10) , peo ,103) Style2 from fintabdatamin where companyid=104companyid Style1 Style2———–

Use ISQLW for Messenger Service in an Intranet

It’s possible to send messages from one system to another system in an Intranet by using ‘xp_cmdshell’ extended stored procedure in MS SQL Server. The usage of this procedure can be as follows: Exec master..xp_cmdshell ‘NET SEND message’Ex: exec master..xp_cmdshell ‘NET SEND prodmaster Hi, How R U?’ Note: The messenger

Dealing with Delimited Strings in T-SQL for Finding Results

A string contains Yes or No answers to a series questions. How do you count the number of correct answers and wrong answers?Here’s the code: DECLARE @TestResults varchar (120)SET @TestResults = ‘YES,NO,YES,NO,YES,NO,YES,YES,YES’SET @TestResults = REPLACE (@TestResults,’YES’,’Y’)SET @TestResults = REPLACE (@TestResults,’NO’,’N’)SET @TestResults = REPLACE (@TestResults,’,’,”)SELECT CorrectAns = LEN(REPLACE (@TestResults, ‘N’, ”)),WrongAns

Write One toString() Method for Most All Your Classes

public String toString(){ StringBuffer sb = new StringBuffer( 256 ); sb.append(“[Field Name] [Value] “); Class curr = this.getClass(); while(curr != null){ Field[] field = curr.getDeclaredFields(); for(int i=0; i

The Difference between “==” and “equals”

The basic difference between the “==” and the “equals” method is to compare the two entities on either side of the operator or the method. But when objects are compared, the “==” checks for the memory address equality while the “equals” method checks the content equality. If the equals method

Use IN in place of OR

If you use OR against a table when you are trying to retrieve rows on matching criteria, it will search the table as many times as matching criteria you gave. However, if you use IN, it will search the table just once and give the output on the search criteria.Basically,

Use JBuilder’s Code Templates to Write Common Java Instructions

JBuilder’s templates allow you to insert some of the most common Java instructions into the editor. For instance, suppose you want to add a main method to a class. Instead of writing everything manually, by using templates you would need only to do this: CTRL+J main There are several dozens

Using the dir() and the dir$() Functions

It’s possible to use the dir() and the dir$() functions to list directories. However, many programmers handle the two first returns from the functions “.” and “..” by using an if statement or a select case within the loop: Public Function ListDirs(Path As String) As String Dim sTemp As String

No more posts to show