Click here to Skip to main content
15,897,718 members
Home / Discussions / Database
   

Database

 
AnswerRe: MS ACESS setting cutureinfo Pin
Eddy Vluggen2-Apr-09 0:04
professionalEddy Vluggen2-Apr-09 0:04 
GeneralRe: MS ACESS setting cutureinfo Pin
udikantz2-Apr-09 1:02
udikantz2-Apr-09 1:02 
QuestionFTP snapshot folder for merge replication Pin
Jay Royall1-Apr-09 3:49
Jay Royall1-Apr-09 3:49 
AnswerRe: FTP snapshot folder for merge replication Pin
Jay Royall1-Apr-09 5:40
Jay Royall1-Apr-09 5:40 
QuestionMS SQL Server 2005 Linked server login timeout Pin
Steven J Jowett1-Apr-09 1:16
Steven J Jowett1-Apr-09 1:16 
AnswerRe: MS SQL Server 2005 Linked server login timeout Pin
Member 34721671-Apr-09 15:12
Member 34721671-Apr-09 15:12 
QuestionSQL Insert [modified] Pin
Vimalsoft(Pty) Ltd31-Mar-09 23:59
professionalVimalsoft(Pty) Ltd31-Mar-09 23:59 
AnswerRe: SQL Insert Pin
Vimalsoft(Pty) Ltd1-Apr-09 4:17
professionalVimalsoft(Pty) Ltd1-Apr-09 4:17 
I got a Solution, and the Solution was that i have to create a Function like this

CREATE FUNCTION [dbo].[f_GenerateRows]
	(@NumRows INT)
RETURNS 
	@Tbl TABLE (pkID INT PRIMARY KEY NOT NULL)
AS
BEGIN
	DECLARE @i INT;
	
	-- SELECT * FROM dbo.f_GenerateRows((SELECT 10))
	
	SET @I = 1
	WHILE @I <= @NumRows BEGIN
		INSERT INTO @Tbl VALUES(@I)
		
		SET @I = @I + 1
	END
	
	RETURN
END


After that i have to do my insert like this in another SP


ALTER PROC sp_Create_Staff_Cycle_Clash
AS

--CHECK IF THE TABLE EXISTS
IF NOT exists(select * from sys.databases where name = 'REC_TERM_CYCLE')
BEGIN
   EXEC CREATE_TABLE_REC_TERM_CYCLE 
END
ELSE
  BEGIN 
   TRUNCATE TABLE DBO.REC_TERM_CYCLE
   DECLARE @ROWS int
   SET @ROWS = (SELECT COUNT(*) FROM tbl_term)
   INSERT INTO REC_TERM_CYCLE (term, cycle)
   SELECT t.ID, i.pkID
   FROM TBL_TERM AS t
   CROSS JOIN dbo.f_GenerateRows(@ROWS) AS i
   WHERE SUBSTRING(t.CYCLETEMPLATES, i.pkID, 1) = '1'
   ORDER BY t.ID, i.pkID
END


now this Works fine, but i wanted to check First if the table exists before i work on it, now if the table exists and i run this sp i get the Following error
Msg 2714, Level 16, State 6, Procedure CREATE_TABLE_REC_TERM_CYCLE, Line 4
There is already an object named 'REC_TERM_CYCLE' in the database.


Please help

Thank you

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za

QuestionCreating Demo Data Pin
Brendan Vogt31-Mar-09 23:03
Brendan Vogt31-Mar-09 23:03 
AnswerRe: Creating Demo Data Pin
Henry Minute1-Apr-09 1:19
Henry Minute1-Apr-09 1:19 
Questionhow this query can be written in sql server Pin
lakshmichawala31-Mar-09 19:00
lakshmichawala31-Mar-09 19:00 
AnswerRe: how this query can be written in sql server Pin
Blue_Boy31-Mar-09 21:02
Blue_Boy31-Mar-09 21:02 
GeneralRe: how this query can be written in sql server Pin
lakshmichawala31-Mar-09 21:05
lakshmichawala31-Mar-09 21:05 
GeneralRe: how this query can be written in sql server Pin
Blue_Boy31-Mar-09 21:16
Blue_Boy31-Mar-09 21:16 
GeneralRe: how this query can be written in sql server Pin
lakshmichawala31-Mar-09 21:25
lakshmichawala31-Mar-09 21:25 
GeneralRe: how this query can be written in sql server Pin
Eddy Vluggen1-Apr-09 0:39
professionalEddy Vluggen1-Apr-09 0:39 
QuestionLooking for good tool to convert Oracle - sql server Pin
E_Gold31-Mar-09 18:18
E_Gold31-Mar-09 18:18 
QuestionSequences?? Pin
Muammar©31-Mar-09 6:31
Muammar©31-Mar-09 6:31 
AnswerRe: Sequences?? Pin
Blue_Boy31-Mar-09 7:16
Blue_Boy31-Mar-09 7:16 
GeneralRe: Sequences?? Pin
Muammar©31-Mar-09 18:47
Muammar©31-Mar-09 18:47 
GeneralRe: Sequences?? Pin
Blue_Boy31-Mar-09 21:04
Blue_Boy31-Mar-09 21:04 
AnswerRe: Sequences?? Pin
Jörgen Andersson31-Mar-09 8:45
professionalJörgen Andersson31-Mar-09 8:45 
GeneralRe: Sequences?? Pin
Muammar©31-Mar-09 18:42
Muammar©31-Mar-09 18:42 
GeneralRe: Sequences?? Pin
Jörgen Andersson31-Mar-09 21:00
professionalJörgen Andersson31-Mar-09 21:00 
QuestionDeploy report project Pin
mehrdadc4831-Mar-09 4:00
mehrdadc4831-Mar-09 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.