usually used for reduce log file size at Ms. SQL
below steps script for reduce NORTHWIND database from 80GB become to 40GB:
(1) . backup the Log
BACKUP LOG NORTHWIND WITH NO_LOG
(2). cek logical name log
sp_helpdb NORTHWIND
(3). shrink the logical log become to 1024kb
DBCC SHRINKFILE (NORTHWIND_Log,1)
Monday, March 29, 2010
Limit function at SQL Server
below Limit function for MySQL server:
select * from berita limit $posisi,$batas
and below for Ms SQL Server:
select top $batas * from wgrn_tbl where WGRN_ITMCD like '%$nama%' and WGRN_GRLNO not in ( select top $posisi WGRN_GRLNO from wgrn_tbl where WGRN_ITMCD like '%$nama%' order by WGRN_ITMCD,WGRN_RCVDT desc) order by WGRN_ITMCD,WGRN_RCVDT desc
Limit function used for e.g: at paging data for website
select * from berita limit $posisi,$batas
and below for Ms SQL Server:
select top $batas * from wgrn_tbl where WGRN_ITMCD like '%$nama%' and WGRN_GRLNO not in ( select top $posisi WGRN_GRLNO from wgrn_tbl where WGRN_ITMCD like '%$nama%' order by WGRN_ITMCD,WGRN_RCVDT desc) order by WGRN_ITMCD,WGRN_RCVDT desc
Limit function used for e.g: at paging data for website
Labels:
SQLserver
Saturday, March 06, 2010
penggunaan select between date di VB
Berikut contoh penggunaan select between date MsSQL di VB6. Misal akan digunakan untuk mencari data berdasar periode tanggal dan ditampilkan di grid.
Perhatikan penggunaan Format(DTPicker1.Value, "mm/dd/yyyy") , karena sering kali di SQL analizer jalan tapi di VB form jalan tapi salah data yg ditampilkannya
Private Sub Command5_Click()
Call BukaDatabase
Adodc3.ConnectionString = STRKoneksi
Adodc3.RecordSource = "SELECT * FROM transaksi where Tanggal between '" & Format(DTPicker1.Value, "mm/dd/yyyy") & "' and '" & Format(DTPicker2.Value, "mm/dd/yyyy") & "'"
Adodc3.Refresh
Set DataGrid1.DataSource = Adodc3
End Sub
Perhatikan penggunaan Format(DTPicker1.Value, "mm/dd/yyyy") , karena sering kali di SQL analizer jalan tapi di VB form jalan tapi salah data yg ditampilkannya
Private Sub Command5_Click()
Call BukaDatabase
Adodc3.ConnectionString = STRKoneksi
Adodc3.RecordSource = "SELECT * FROM transaksi where Tanggal between '" & Format(DTPicker1.Value, "mm/dd/yyyy") & "' and '" & Format(DTPicker2.Value, "mm/dd/yyyy") & "'"
Adodc3.Refresh
Set DataGrid1.DataSource = Adodc3
End Sub
Labels:
VB
selection formula Dtpicker at VB - CrystalReport
from CrystalReport : Any dates that are being passed to Crystal Reports must be in Crystal Reports Date format, Date(yyyy,mm,dd).
MsSQL server and Crstal report, have diffrent format data.
so please use this one:
Private Sub Command1_Click()
CrystalReport1.Connect = "ODBC;driver=SQLSERVER;" & "UID=sa;pwd=password;server=server_name;DATABASE=database_name"
CrystalReport1.ReportFileName = App.Path & "\REPORT\report111.rpt"
Qry = "{Transaksi.Tanggal} >= " & Format(DTPicker1, "\Date(yyyy,mm,dd)") & " " _
& "And {Transaksi.Tanggal} <= " & Format(DTPicker2, "\Date(yyyy,mm,dd)")
CrystalReport1.SelectionFormula = Qry
CrystalReport1.RetrieveDataFiles
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = 1
End Sub
MsSQL server and Crstal report, have diffrent format data.
so please use this one:
Private Sub Command1_Click()
CrystalReport1.Connect = "ODBC;driver=SQLSERVER;" & "UID=sa;pwd=password;server=server_name;DATABASE=database_name"
CrystalReport1.ReportFileName = App.Path & "\REPORT\report111.rpt"
Qry = "{Transaksi.Tanggal} >= " & Format(DTPicker1, "\Date(yyyy,mm,dd)") & " " _
& "And {Transaksi.Tanggal} <= " & Format(DTPicker2, "\Date(yyyy,mm,dd)")
CrystalReport1.SelectionFormula = Qry
CrystalReport1.RetrieveDataFiles
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = 1
End Sub
Labels:
VB
Subscribe to:
Posts (Atom)