Click here to Skip to main content
15,895,370 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to move data from one db to another db Pin
Niladri_Biswas23-Jun-09 18:17
Niladri_Biswas23-Jun-09 18:17 
GeneralRe: how to move data from one db to another db Pin
Jerry Hammond23-Jun-09 19:50
Jerry Hammond23-Jun-09 19:50 
Questionfull text indexed Pin
almasoudi22-Jun-09 23:12
almasoudi22-Jun-09 23:12 
AnswerRe: full text indexed Pin
Eddy Vluggen23-Jun-09 0:18
professionalEddy Vluggen23-Jun-09 0:18 
QuestionHelp me with SQL query Pin
anderslundsgard22-Jun-09 21:00
anderslundsgard22-Jun-09 21:00 
AnswerRe: Help me with SQL query Pin
Blue_Boy22-Jun-09 21:35
Blue_Boy22-Jun-09 21:35 
GeneralRe: Help me with SQL query Pin
Niladri_Biswas23-Jun-09 19:00
Niladri_Biswas23-Jun-09 19:00 
AnswerRe: Help me with SQL query Pin
Niladri_Biswas24-Jun-09 20:09
Niladri_Biswas24-Jun-09 20:09 
Hi, I have written a Stored Procedure for doing this.

The Table Name is TBLEXTRACT_STRING with the same columns and the same values

ALTER PROCEDURE SP_UPDATELASTCOLUMN 
	-- Add the parameters for the stored procedure here
	
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	-- VARIABLE DECLARATION SECTION

		DECLARE @CNTRECORDS INT
		DECLARE @NAMEVALS VARCHAR(50)
		DECLARE @I INT

	-- SETTING THE INITIAL VALUES
		SET @I  = 1
     
        SELECT @CNTRECORDS = COUNT(*) FROM TBLEXTRACT_STRING

		SELECT ROW_NUMBER() OVER (ORDER BY ID) AS ROWID,* INTO #TEMP FROM TBLEXTRACT_STRING

		
		WHILE ( @I <= @CNTRECORDS )

			BEGIN
					SELECT @NAMEVALS = [NAME] 
					FROM #TEMP
					WHERE ROWID = @I
					
					UPDATE TBLEXTRACT_STRING

					SET PART = (SELECT TOP 1 STRINGVAL FROM DBO.FNSPLIT(@NAMEVALS,',') 
								ORDER BY COUNTER DESC)

					WHERE ID  = (121 + @I)					
					SET @I = @I + 1		
			END

		DROP TABLE #TEMP
END
GO


And the Split function(fnSplit) is as under

ALTER FUNCTION [dbo].[fnSplit] 
(@oldstring as varchar(100),@delimeter as varchar(1))
RETURNS @mytab table(counter int,stringval varchar(100)) 
AS
Begin 
		
		Declare @newstring as varchar(100)
		Declare @pos as int
		Declare @i as int
		Declare @c as int	

		set @newstring = '';		
		set @i = 1
		set @c = 0

		set @pos = CHARINDEX(@delimeter, @oldstring) 

		WHILE (@i != 0)

			Begin

				set @c = @c +1
				insert into @mytab(counter,stringval) values(@c,@newstring + Substring(@oldstring,0, @pos))
				
				set @oldstring = Substring(@oldstring,@pos+1,len(@oldstring))

				set @pos = CHARINDEX(@delimeter, @oldstring)

				set @i = @pos;
				if (@i = 0)
                Begin
                    set @i = 0;
						set @c = @c +1
                
					insert into @mytab(counter,stringval) values(@c,@newstring + @oldstring)
				
				
                End
			End

			return

End


Hope this helps
Smile | :)

Niladri Biswas

QuestionINDEX and INSERT in SQL Server 2005 Pin
sujithkumarsl22-Jun-09 20:57
sujithkumarsl22-Jun-09 20:57 
AnswerRe: INDEX and INSERT in SQL Server 2005 Pin
Ashfield22-Jun-09 21:00
Ashfield22-Jun-09 21:00 
GeneralRe: INDEX and INSERT in SQL Server 2005 Pin
sujithkumarsl22-Jun-09 22:39
sujithkumarsl22-Jun-09 22:39 
GeneralRe: INDEX and INSERT in SQL Server 2005 Pin
Ashfield23-Jun-09 1:42
Ashfield23-Jun-09 1:42 
GeneralDisplay Execution Plan Pin
David Mujica23-Jun-09 2:57
David Mujica23-Jun-09 2:57 
QuestionWhich of those MySQL Licenses do I need? Pin
softwarejaeger22-Jun-09 20:28
softwarejaeger22-Jun-09 20:28 
QuestionMS ACCESS QUery Pin
jonhbt22-Jun-09 19:50
jonhbt22-Jun-09 19:50 
AnswerRe: MS ACCESS QUery Pin
_Damian S_22-Jun-09 20:06
professional_Damian S_22-Jun-09 20:06 
GeneralRe: MS ACCESS QUery Pin
jonhbt22-Jun-09 20:37
jonhbt22-Jun-09 20:37 
GeneralRe: MS ACCESS QUery Pin
_Damian S_22-Jun-09 20:48
professional_Damian S_22-Jun-09 20:48 
GeneralRe: MS ACCESS QUery Pin
jonhbt22-Jun-09 21:04
jonhbt22-Jun-09 21:04 
GeneralRe: MS ACCESS QUery Pin
_Damian S_23-Jun-09 2:42
professional_Damian S_23-Jun-09 2:42 
AnswerRe: MS ACCESS QUery Pin
Niladri_Biswas22-Jun-09 20:25
Niladri_Biswas22-Jun-09 20:25 
GeneralRe: MS ACCESS QUery Pin
jonhbt22-Jun-09 20:34
jonhbt22-Jun-09 20:34 
QuestionQuestion about Database Roles and Securables Pin
Mustafa Ismail Mustafa22-Jun-09 6:52
Mustafa Ismail Mustafa22-Jun-09 6:52 
QuestionRegarding Sql server2005 and X-Query? Pin
Tridip Bhattacharjee22-Jun-09 1:51
professionalTridip Bhattacharjee22-Jun-09 1:51 
QuestionAlternative row Pin
yesu prakash21-Jun-09 23:07
yesu prakash21-Jun-09 23:07 

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.