Click here to Skip to main content
15,912,319 members
Home / Discussions / Database
   

Database

 
AnswerRe: Automatic update table based on time Pin
PIEBALDconsult21-Feb-11 8:21
mvePIEBALDconsult21-Feb-11 8:21 
GeneralRe: Automatic update table based on time Pin
AhmedMasum22-Feb-11 1:28
AhmedMasum22-Feb-11 1:28 
GeneralRe: Automatic update table based on time Pin
PIEBALDconsult22-Feb-11 10:37
mvePIEBALDconsult22-Feb-11 10:37 
QuestionCannot use mysql in linux fedora14. Do we have to install it or the bydefault coming is fine. Pin
cmaheshwari1619-Feb-11 2:30
cmaheshwari1619-Feb-11 2:30 
AnswerRe: Cannot use mysql in linux fedora14. Do we have to install it or the bydefault coming is fine. Pin
ScottM121-Feb-11 18:57
ScottM121-Feb-11 18:57 
Questionhow to change a color of particular word in the row in ssrs reports Pin
vinu.111119-Feb-11 0:51
vinu.111119-Feb-11 0:51 
AnswerRe: how to change a color of particular word in the row in ssrs reports Pin
Wendelius19-Feb-11 1:17
mentorWendelius19-Feb-11 1:17 
QuestionSQL Express Redistribution Pin
εїзεїзεїз18-Feb-11 22:00
εїзεїзεїз18-Feb-11 22:00 
AnswerRe: SQL Express Redistribution Pin
Wendelius18-Feb-11 22:15
mentorWendelius18-Feb-11 22:15 
GeneralRe: SQL Express Redistribution Pin
εїзεїзεїз19-Feb-11 18:29
εїзεїзεїз19-Feb-11 18:29 
GeneralRe: SQL Express Redistribution Pin
Wendelius20-Feb-11 7:05
mentorWendelius20-Feb-11 7:05 
AnswerRe: SQL Express Redistribution Pin
PIEBALDconsult19-Feb-11 5:24
mvePIEBALDconsult19-Feb-11 5:24 
GeneralRe: SQL Express Redistribution Pin
Wendelius19-Feb-11 6:58
mentorWendelius19-Feb-11 6:58 
GeneralRe: SQL Express Redistribution Pin
εїзεїзεїз19-Feb-11 18:29
εїзεїзεїз19-Feb-11 18:29 
GeneralRe: SQL Express Redistribution Pin
εїзεїзεїз19-Feb-11 18:30
εїзεїзεїз19-Feb-11 18:30 
QuestionInsert Record into Access Pin
Brad Fackrell18-Feb-11 4:52
Brad Fackrell18-Feb-11 4:52 
AnswerRe: Insert Record into Access Pin
Luc Pattyn18-Feb-11 5:23
sitebuilderLuc Pattyn18-Feb-11 5:23 
GeneralRe: Insert Record into Access Pin
Brad Fackrell18-Feb-11 5:41
Brad Fackrell18-Feb-11 5:41 
GeneralRe: Insert Record into Access Pin
Wendelius18-Feb-11 5:42
mentorWendelius18-Feb-11 5:42 
AnswerRe: Insert Record into Access Pin
Wendelius18-Feb-11 5:26
mentorWendelius18-Feb-11 5:26 
GeneralRe: Insert Record into Access Pin
Brad Fackrell18-Feb-11 5:45
Brad Fackrell18-Feb-11 5:45 
QuestionHi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure [modified] Pin
Thabo@Codeproject18-Feb-11 4:52
Thabo@Codeproject18-Feb-11 4:52 
This is the senario, i am trying to copy a table and store that table into a XML variable(Not physically xml file) and read that XML variable ,at the same time also trying to retrive and insert all data to another table.The stored procedure is given below
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:     Thabo
-- Create date: 18.02.2011
-- Description:	TEST XML
-- =============================================
CREATE PROCEDURE sppassingStoredProcedue
	 DECLARE @x XML 
AS
BEGIN

SET NOCOUNT ON;
SET @x=(SELECT PramryKeyForThisTable,AutoNumberColumn,Data1,Data2,Data3 FROM tblInsertTableForAutoNumber FOR XML AUTO ,TYPE ,ELEMENTS XSINIL,ROOT ('TABLEROOT'))

INSERT INTO CopyOftblInserTableForAutonumber
SELECT
	tab.col.value('@PrimaryKeyForThisTable[1]','SMALLINT') AS PramryKeyForThisTable,
	tab.col.value('@AutoNumberColumn[1]','SMALLINT')AS AutoNumberColumn,
	tab.col.value('@Data1[1]','VARCHAR(50)') AS Data1,
	tab.col.value('@Data2[1]','VARCHAR(50)') AS Data2,
	tab.col.value('@Data3[1]','VARCHAR(50)') AS Data3
FROM @x.nodes('//TABLEROOT/tblInsertTableForAutoNumber')AS tab(Col)	
	
END


Actually the second table is the copy of the first table.It has same stucure of the first table
The table structure is,

colum name datatype
----------- --------
PramryKeyForThisTable smallint
AutoNumberColumn smallint
Data1 varchar(50)
Data2 varchar(50)
Data3 varchar(50)


I have got different different error messages every time.i hve got this error message for above cording.
Msg 156, Level 15, State 1, Procedure sppassingStoredProcedue, Line 7
Incorrect syntax near the keyword 'DECLARE'.
Msg 156, Level 15, State 1, Procedure sppassingStoredProcedue, Line 8
Incorrect syntax near the keyword 'AS'."


I couldnt figure out how to do this. Can any one pls give a good solution for this.

Thabo


-- Modified Friday, February 18, 2011 11:33 AM

AnswerRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Wendelius18-Feb-11 5:21
mentorWendelius18-Feb-11 5:21 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Thabo@Codeproject18-Feb-11 5:54
Thabo@Codeproject18-Feb-11 5:54 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Wendelius18-Feb-11 6:22
mentorWendelius18-Feb-11 6:22 

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.