Saturday, August 31, 2013

What is MVC Model View Controller

This video explains the concept of MVC software architecture pattern, stands for Model View Controller.


Sunday, December 23, 2012

ORACLE IS_MEMBER function like in SQL SERVER


CREATE OR REPLACE FUNCTION IS_MEMBER(  USER_ID Varchar  ) 
RETURN   NUMBER  IS    
dResult NUMBER; 
sLoginUser Varchar(200); 
BEGIN  
   dResult :=0;    
   SELECT  user into sLoginUser  from  dual; 
    IF upper(sLoginUser)= upper(USER_ID) THEN    
       dResult :=1; 
    END IF;  
RETURN  dResult;  
END;
/

Sunday, November 20, 2011

Find the error in following




Subject: Find the error, its impossible
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


 Did you know that 80% of UCDS students could not find the error above?
 Forward this to at least 5 people with the title 'Find the error, its impossible', and when you click 'Send', the answer will be right in front of your eyes!



Monday, January 10, 2011

How reducing the sql server database log file


 1.                 Login to the SQL server 2005 under "sa" login. Then run the following command
2.         Take a full backup of the database.
3.         Now run the following.

USE <write the database name>;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE <write the database name>
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 10 MB.
DBCC SHRINKFILE (<Database Logical Name>, 10);
GO
-- Reset the database recovery model.
ALTER DATABASE <write the database name>
SET RECOVERY FULL;
GO

NOTE : if the database recovery model was originally SIMPLE, then change it to SIMPLE after running the above script.
But if it is originally "FULL", then no need to change it again. Because the above script automatically change it to "FULL".



Sunday, October 3, 2010

How To Obtain The Size Of All Tables In A SQL Server Database

SET NOCOUNT ON 

DBCC UPDATEUSAGE(0) 

-- DB size.
EXEC sp_spaceused

-- Table row counts and sizes.
CREATE TABLE #t 
    [name] NVARCHAR(128),
    [rows] CHAR(11),
    reserved VARCHAR(18), 
    data VARCHAR(18), 
    index_size VARCHAR(18),
    unused VARCHAR(18)

INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?''' 

SELECT *
FROM   #t

-- # of rows. 

SELECT   REPLACE(data,'KB','')  FROM   #t --order by data  

alter table  #t add data_1 numeric(18,2) 




UPDATE   #t SET data_1=convert(numeric(18,2),REPLACE(data,'KB',''))





SELECT *   FROM   #t order by data_1


 
DROP TABLE #t 

Thursday, September 30, 2010

How to export the data to existing EXCEL file from the SQL Server table


http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
     
       
IF  EXISTS (SELECT srv.name FROM sys.servers srv WHERE srv.server_id != 0 AND srv.name = N'XLS')EXEC master.dbo.sp_dropserver @server=N'XLS', @droplogins='droplogins'
GO
    
EXEC sp_addlinkedserver N'XLS', 'Jet 4.0','Microsoft.Jet.OLEDB.4.0','c:\testing.xls',NULL,'Excel 5.0;

declare @text VARCHAR(400)

SET @text='HBS '

insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 5.0;Database=c:\testing.xls;',  'SELECT * FROM [Sheet1$]') select EMP_NUMBER, emp_calling_name ,@text TEXT from DSI.hs_hr_employee --where  emp_number='000001'