|
Oops. I should have stated that my code does work, but not the manner I was hoping. Yes, I got the same results you are seeing but I wanted to be able to see 1 row returned. In an ideal world, it would have showed me "FIELD1" and the value of "UNITED STATES". I'm a novice at XML processing, so please bear with me.
Is what I'm asking for possible ? If not I will have to work around it by using some logic that will link the two records together by the node type and parent id. Thanks again for the quick response.
|
|
|
|
|
No problem
One way is to use SQL to manipulate results. For example:
SELECT set1.localname, set2.text
FROM OPENXML (@idoc, '/DATAMATRIX/FSDATAMATRIX',1) set1
INNER JOIN
OPENXML (@idoc, '/DATAMATRIX/FSDATAMATRIX',1) set2
ON set1.id = set2.parentid
WHERE set1.LocalName = 'FIELD1'
Remember that you can define the columns you need from the xml by using WITH clause.
Of course if you can modify the XML, you could set the texts as attributes instead of elements, which could simplify your code.
Hope this helps,
Mika
|
|
|
|
|
SELECT *
FROM OPENXML (@idoc, '/DATAMATRIX/FSDATAMATRIX',1)
WITH ( DM_OBJECT_TYPE VARCHAR(100) 'DM_OBJECT_TYPE'
, FIELD1 VARCHAR(100) 'FIELD1'
, FIELD2 VARCHAR(100) 'FIELD2'
, FIELD3 VARCHAR(100) 'FIELD3'
, FIELD4 VARCHAR(100) 'FIELD4'
, FIELD5 VARCHAR(100) 'FIELD5'
)
Please... SAVE my time by rating the posts that you read!
There are 10 kinds of people in the world: those who understand binary and those who don't.
|
|
|
|
|
Thank you to those who have responded, I can get the data XML results. The next problem is that I need to be able to Insert, Update and Delete XML data stored in one of my tables. The table consists of a primary key and a "TEXT_DATA" column that contains the XML data. The wrinkle here is that the TEXT_DATA column is defined as ntext.
I'm struggling with XQUERY commands to manipulate the data. Your help is greatly appreciated.
|
|
|
|
|
Hi,
Try simply casting the text to xml datatype and use the result for xml dml operations. Simple case to test that casting actually works:
SELECT CAST( CAST( '<root><node1 value="A" /></root>' as ntext) as xml) XmlTypedColumn
Mika
p.s. You could start a new thread for separate questions
|
|
|
|
|
hi all
i get above error when using this code snippet
Dim svr As Server = New Server()
Console.Writeline(svr.Name & " " & svr.Information.VersionString)
i already import the the SMO as following
Imports Microsoft.SqlServer.Management.Smo
please suggest how can i solve this problem
|
|
|
|
|
Could be the server isn't running, your connection string is not setup right, or firewall.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi all,
i am new to SQL Server but little strong in vb.net
i want to create Backup file of any database of SQL server and again restore them to server . So how can i do this task Programmatically. Also what is the option when Authentication mode is Windows or Server or Mix-Mode
|
|
|
|
|
You are not mentioned here SQL Server version.
If you are using SQL2005 then do some research on SQL Server Management Objects (SMO). It provides the all kind of Database management facility including backup and restore.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Windows Authentication uses active directory credentials
Mix mode will also allow standard sql server authentication.
There are pros and cons to both of these, and entire articles/books written on them. We use windows authentication for the developers and admins who need to interact with the database directly and SQL credentials for the applications to interact.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi all,
i am new bie in SQL server
i want to store Database with my application on client machine . However i know i add one for setup for Database but how can get the server name of system (mean SQL server name on client machine). Reason behind this question is that i use server name in connection string as following
Dim ConnectionString As String = "Data Source=s-1\SQLEXPRESS;Initial Catalog=abc;Integrated Security=True"
i use above string .In which server name is "s-1\SQLExpress" . so how can replace this server name to client machine server name?
|
|
|
|
|
I believe this will be the name of your computer unless you can install an instance of SQL Express.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sir,First of all , i am new bie
actually i dont know what is the configuration of client machine . so i suppose user simply add the database in their Server. and run my application . so how could i get the Server Part in following connection string
Dim ConnectionString As String = "Data Source=s-1\SQLEXPRESS;Initial Catalog=abc;Integrated Security=True"
Here server is S-1
and instance is SQLExpress. Correct me if i wrong
|
|
|
|
|
Nope you do not need correcting. I would make it a prerequisite of your install package - ask the use for the server name to use.
I'm not sure the Express version announces itself to the network like SQL server does. Even if it does, how are you going to pick between the # number of SQL instances on the network. Last I looked we have over 300 SQL server instances on ours.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sir, i does not properly get you
Are you want to say that I add Database as Prerequiste of Installation Package and After installation of application, when user run the application first time, then it ask for Server Name and store server name in some place like text file or registry ? Please correct me
|
|
|
|
|
I think what he want to say is, your database creation progrom should ask the database information, as sql expressoin cant be reachable accross network, so you also need to change the connection string. after getting the database info you update your configuration file.
|
|
|
|
|
Mycroft Holmes wrote: over 300 SQL server instances on ours
Oh boy.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Yeah I work for a bank, they have 4 data centers, 2 production and 2 DR. They run 2 discreet networks UAT and production. Deployment is a PITA
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: have 4 data centers, 2 production and 2 DR
Sounded like with that many instances, you are at a good sized shop.
Mycroft Holmes wrote: Deployment is a PITA
I imagine so. helps after a tough day in any shop
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Paul Conrad wrote: you are at a good sized shop.
Yeah but I work in one department and IT hate me, I have a mandate to "get the job done" and worry about enterprise requirements later. Therefore I'm not subject to the endless meetings IT seem to require before they allow you to start coding, it also means there is no such thing as a requirements document either so it has it's drawbacks.
Thanks for the beer, I may wait as it is 9:30 on a Sunday and thats a bit early even for me!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
This article, Finding SQL Servers on the Network[^] may be worth looking at. Not sure how it responds to SQL Express or SQL 2008.
The above article is based on odbc, this other one, Enumerating SQL servers on a Network[^] looks good, too.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
modified on Saturday, July 26, 2008 9:08 PM
|
|
|
|
|
Hi
I've a Table Table1.And it's structure is
RoleID RoleDescription Department
1 Manager Accounts
2 Senior Manager Finance
and I want to have a Table like
Columnname Columnvalue Date
RoleID 1 2/5/2008
RoleDescription Manager 2/5/2008
Department Accounts 2/5/2008
RoleID 2 2/5/2008
RoleDescription Senior Manager 2/5/2008
Department Finance 2/5/2008
Can anyone tell how?
thanks in advance
Sri
|
|
|
|
|
I realy dont understand what you just asked
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Dear gurus,
I am developing a charting application that should plot [double] values against [DateTime] values. In a single turn, there can be as much as 10 million data points.
What I do is to extract the data from SQL Server and use ChartDirector to plot it. For about 1 million data, extraction takes 25 seconds and plotting takes 20 seconds.
This is a lot of time to wait for user. Can you please suggest me any?
like sampling to reduce the data, or fast extraction, or fast plotting?
Thanking you!
|
|
|
|
|
The obvious one is to reduce the number of data points over the entire time frame IE get 1 data point per week/month. Allow the user to drill into a specific week/month at which time you may show all or data points. You can't actually see 10mio datapoints, the values would become irrelevant over such a large size.
BTW 45 sec to get 10mio rows of data seems eminently reasonable to me.
Never underestimate the power of human stupidity
RAH
|
|
|
|