Click here to Skip to main content
15,913,941 members
Home / Discussions / Database
   

Database

 
QuestionStoring Result Of A Select Statement In A Variable Pin
MadDashCoder23-Oct-15 13:13
MadDashCoder23-Oct-15 13:13 
AnswerRe: Storing Result Of A Select Statement In A Variable Pin
CHill6025-Oct-15 4:52
mveCHill6025-Oct-15 4:52 
AnswerRe: Storing Result Of A Select Statement In A Variable Pin
Anudeep Jaiswal - MCA17-Nov-15 18:22
Anudeep Jaiswal - MCA17-Nov-15 18:22 
--[Spgetdata] 1,2,3
ALTER PROC [dbo].[Spgetdata] @Col1 INT,
@Col2 INT,
@Col3 INT
AS
BEGIN
DECLARE @count INT
DECLARE @currentColumn NVARCHAR(25)
DECLARE @currentColumnVal NVARCHAR(25)

SET @count = 1
SET @currentColumn = NULL
SET @currentColumnVal = NULL

CREATE TABLE #tempTable
(
ID INT NOT NULL IDENTITY(1, 1) PRIMARY KEY,
Val1 INT,
Val2 INT,
Val3 INT
)

INSERT #tempTable
(Val1,
Val2,
Val3)
VALUES(@Col1,
@Col2,
@Col3)

SET @count = 1

WHILE @count <= 3
BEGIN
SET @currentColumn = 'Val' + Cast(@count AS VARCHAR(25))

--SELECT @currentColumnVal = @currentColumn
--FROM #tempTable
DECLARE @Q NVARCHAR(Max)

SET @Q = 'SELECT @currentColumnValX = '
+ @currentColumn + ' FROM #tempTable'

EXEC Sp_executesql
@Q,
N'@currentColumnValX varchar(500) Output',
@currentColumnVal Output

-- Do stuff
-- Do more Stuff
SET @count = @count + 1
END

PRINT @currentColumnVal -- Just to see what the value of the last Column is
END
Questionhow to create a database if data is given? Pin
Member 1127090223-Oct-15 6:00
Member 1127090223-Oct-15 6:00 
AnswerRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 6:29
professionalEddy Vluggen23-Oct-15 6:29 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 7:02
Member 1127090223-Oct-15 7:02 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 7:17
professionalEddy Vluggen23-Oct-15 7:17 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 7:28
Member 1127090223-Oct-15 7:28 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 8:08
professionalEddy Vluggen23-Oct-15 8:08 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 8:25
Member 1127090223-Oct-15 8:25 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 8:31
professionalEddy Vluggen23-Oct-15 8:31 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 8:49
Member 1127090223-Oct-15 8:49 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 8:55
professionalEddy Vluggen23-Oct-15 8:55 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 9:02
Member 1127090223-Oct-15 9:02 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 9:14
professionalEddy Vluggen23-Oct-15 9:14 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 9:20
Member 1127090223-Oct-15 9:20 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 9:48
professionalEddy Vluggen23-Oct-15 9:48 
GeneralRe: how to create a database if data is given? Pin
Member 1127090223-Oct-15 18:47
Member 1127090223-Oct-15 18:47 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen23-Oct-15 23:22
professionalEddy Vluggen23-Oct-15 23:22 
GeneralRe: how to create a database if data is given? Pin
Member 1127090216-Nov-15 23:41
Member 1127090216-Nov-15 23:41 
GeneralRe: how to create a database if data is given? Pin
Eddy Vluggen17-Nov-15 0:46
professionalEddy Vluggen17-Nov-15 0:46 
QuestionAmazon RDS IP Address Pin
R. Giskard Reventlov21-Oct-15 5:21
R. Giskard Reventlov21-Oct-15 5:21 
SuggestionRe: Amazon RDS IP Address Pin
Kornfeld Eliyahu Peter21-Oct-15 8:50
professionalKornfeld Eliyahu Peter21-Oct-15 8:50 
GeneralRe: Amazon RDS IP Address Pin
R. Giskard Reventlov21-Oct-15 9:09
R. Giskard Reventlov21-Oct-15 9:09 
QuestionValidating data between RDBMS (Mysql/ Oracle / DB2) and Hadoop ( HDFS/ Hive) Pin
Member 1204409721-Oct-15 4:14
Member 1204409721-Oct-15 4:14 

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.