Thursday, March 5, 2015

sql server Compare Time Field between interval

declare @ts1 as time;
SELECT @ts1 = CAST('08:00:00 AM' AS TIME);

declare @ts2 as time;
SELECT @ts2 =CAST('12:00:00 PM' AS TIME);

select * from tasks.dbo.Tasks_PerHour_view
where jobtime between  CONVERT(time(0), @ts1) and CONVERT(time(0), @ts2)

Friday, February 27, 2015

sql server restore database error Exclusive access could not be obtained because the database is in use

To solve this error


use Master
alter database Hospital_db_22_02 set offline with rollback immediate
alter database Hospital_db_22_02
set online
go




Wednesday, February 18, 2015

runtime error the type x exists in both x and y

i got this error in web site run under version 4 framework for user control assembly at runtime

Solution :

add this property to web.config file
<compilation debug="false" targetFramework="4.0" batch="false">

Explain for solution :
http://stackoverflow.com/questions/2596118/asp-net-error-the-type-foo-exists-in-both-temp1-dll-and-temp2-dll-pt-2

http://www.sellsbrothers.com/Posts/Details/1995

Friday, February 6, 2015


EXMAPLE : WITH USERNAME AND PASSWORD

NET USE \\10.10.10.X\emp_identification_letters /u:mosbah P@$$w0rd
NET USE \\10.10.10.X\Catalog /u:mosbah P@$$w0rd

robocopy /MIR D:\MWA_STORE\TENDERS_STORE \\10.10.10.X\Catalog
robocopy /MIR D:\MWA_STORE\EMP_IDENTIFICATION_LETTERS  \\10.10.10.X\emp_identification_letters
break


-----------------------------------------------------------------------------------------------------------------------
robocopy /MIR D:\MWA_STORE\TENDERS_STORE M
robocopy /MIR D:\MWA_STORE\EMP_IDENTIFICATION_LETTERS N
break
--pause
-----------------------------------------------------------------------------------------------------

synchronize using shared storage passing username and password for security issue
note : the task should run with user has permission to shared storage and local server


NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups /user:.\sqluser P@$$w0rd
Robocopy "F:\Doc_Server2" "\\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups"  /MIR /FFT /Z /XA:H /W:5
NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups /delete


NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups /user:.\sqluser P@$$w0rd
Robocopy "E:\Doc_Server1" "\\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups"  /MIR /FFT /Z /XA:H /W:5
NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups /delete






Monday, January 26, 2015

sql server shrink command

USE HOSPITAL_DB
 select name,recovery_model_desc from sys.databases
 ALTER DATABASE HOSPITAL_DB SET RECOVERY simple

 DBCC SHRINKFILE (CDCDataStore , 1)


 --get datafiles from database to use in shrinkfile dbcc command

SELECT file_id, name
FROM sys.database_files;

Monday, January 19, 2015

Temp Directory Delete Patch File Command

to delete temp directory files older than 2 days put the following command in .bat file 
and create scheduled task to run it every day once

forfiles -p  C:\Doc_Server_Temp\ -d -2 -c "cmd /c del @path"

where  C:\Doc_Server_Temp\ is the temp directory you want to delete its files.

Monday, January 5, 2015

Eclips Error : java was started by returned exit code=13 java 8

http://www.ashout.com/fix-java-started-returned-exit-code13-eclipse/


Eclips.ini file

-startup

plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326

--product

org.eclipse.epp.package.java.product

--launcher.defaultAction

openFile

--launcher.XXMaxPermSize

256M

--showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

256m

--launcher.defaultAction

openFile

--launcher.appendVmargs

-vm
C:\Program Files\Java\jre8\bin\javaw.exe
-vmargs

-Dosgi.requiredJavaVersion=1.6

-Xms40m

-Xmx512m