Nov 1, 2007

Update DB Data With Leading Zero Format

UPDATE EM_MST_EMPLOYEE
SET PIN = '0' + PIN
WHERE ({ fn LENGTH(PIN) } = 7)

Shrink SQL Data Log File

When DBCC SHRINKFILE is run, SQL Server 2000 shrinks the log file by removing as many virtual log files as it can to attempt to reach the target size. If the target file size is not reached, SQL Server places dummy log entries in the last virtual log file until the virtual log is filled and moves the head of the log to the beginning of the file. The following actions are then required to complete the shrinking of the transaction log:

1. You must run a BACKUP LOG statement to free up space by removing the inactive portion of the log.

2. You must run DBCC SHRINKFILE again with the desired target size until the log file shrinks to the target size.

The following example demonstrates this with the pubs database and attempts to shrink the pubs_log file to 2 MB:
1. Run this code:

DBCC SHRINKFILE(pubs_log, 2)


NOTE: If the target size is not reached, proceed to the next step.

2. Run this code if you want to truncate the transaction log and not keep a backup of the transaction log. Truncate_only invalidates your transaction log backup sequence. Take a full backup of your database after you perform backup log with truncate_only:

BACKUP LOG pubs WITH TRUNCATE_ONLY

-or-
Run this code if you want to keep a backup of your transaction log and keep your transaction log backup sequence intact. See SQL Server Books Online topic "BACKUP" for more information:

BACKUP LOG pubs TO pubslogbackup

3. Run this code:

DBCC SHRINKFILE(pubs_log,2)

must run step 1,2 then 3

Oct 30, 2007

Get Physical File Path, Virtual Directory

oFSO = Server.CreateObject("Scripting.FileSystemObject")
sPath = Server.MapPath("Moozik\")
fRoot = oFSO.GetFolder(sPath)


(web paths, not full physical)

My file: /Test/Myfile.aspx
Virtual directory: /Test/VirtualDir/
Code: Server.MapPath("VirtualDir/")

or if you are in a higher directory:

MyFile: /Test/Something/MyFile.aspx
Virutal: /VirtualDir/
Code: Server.MapPath("../../VirtualDir/")

You are probably just getting the virtual path (the one that gets sent into
MapPath) wrong.

How To Change Vista Desktop Icon Size

Just start using Windows Vista and found the desktop icon is too large which to allow me to put more items on desktops.

so... any of you face the same ?


Solution:

Right-click the desktop, choose View, and choose between "Classic icons", "Medium icons" and "Large icons" (the default is medium).

=)

Crystal Report VS Microsoft Report

Now I develop under Visual Studio 2005 and I use only Microsoft report system.

Those are the benefits I found:

- xml structure, so you can programmatically modify report structure;

- built in support for DataSets as data source;

- good parameters system;

- much faster than CR in rendering (i have reports > 1.000 pages).


Microsoft report system have some never fixed bug, as visual studio 2005, but for my experience is much better than Cr.


Win App Local Application Path

LocalReport.ReportPath = _

My.Application.Info.DirectoryPath & "\Reports\" & "myReport.rdlc"



Where myReport.rdlc is located under Reports folder in my win app program.