Archive for the cateroy Database

« Older Entries  

SQL Server 2005 OWC11 Installation Failure

While installing SQL server 2005, i have come across the
 error
ERROR 1706 Setup cannot find the required files,Check
your connection to the network, or cd rom, For other
potential solutions to this problem, see c:\Program
Files\Microsoft Office\Office11\1033\Setup.chm

Solution :
You need to run the file OWC11.msi, its available in
Tools folder of SQL 2005
also you can download from Miscrosoft’s Site
http://www.microsoft.com/downloads/details.aspx?FamilyId
=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en
 
then try to [...]

Split Function in SQL

CREATE FUNCTION dbo.fnSplit(
    @sInputList VARCHAR(8000) — List of delimited items
  , @sDelimiter VARCHAR(8000) = ‘,’ — delimiter that separates items
) RETURNS @List TABLE (item VARCHAR(8000))
BEGIN
DECLARE @sItem VARCHAR(8000)
WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
 BEGIN
 SELECT
  @sItem=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1))),
  @sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+LEN(@sDelimiter),LEN(@sInputList))))
 
 IF LEN(@sItem) > 0
  INSERT INTO @List SELECT @sItem
 END
IF LEN(@sInputList) > 0
 INSERT INTO @List SELECT @sInputList — Put the last item in
RETURN
END
GO
 
 
–Test
select * from [...]

Foreign Key Reference more than 1 table

create table address(addr_No int not null, cust_no int not null, emp_no int not null, blah, blah, primary key(addr_No),
index(cust_No), index(emp_No),
Foreign Key(cust_No) references customer(cust_No),
Foreign Key(emp_No) references employee(emp_No));
Source : http://www.dbforums.com/ansi-sql/983522-foreign-key-referencing-more-than-1-table.html