|
It looks like you're trying to perform some iterative operation. Have you looked at FLWOR? http://technet.microsoft.com/en-us/library/ms190945.aspx[^]
I haven't had cause to use much XQuery in SQL, but it would seem this is better suited. If that's not what you're looking for have you tried constructing the string outside the value() function? Sometimes SQL doesn't like it when you try and pass operations to parameters and you have to pass a ready-made value. Like this:
<br />
SET @xQueryExpression = '(//mislife/insurance/party/@pno)' + str(@iCounter)<br />
Content.value(@xQueryExpression, 'varchar(max)')<br />
Mark's blog: developMENTALmadness.blogspot.com
Funniest variable name:
lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher
|
|
|
|
|
Thank you!
The .value can just handle an complete string. I have desided to do the operation in .net code instead.
I will read the data into xmlnodes.
Thank you very much!
/Tommy
|
|
|
|
|
Just got asked about this, so how can we do it? I'm pretty sure that they want it into SQL, but we also have a DB2 environment, so if anyone knows how to do that it would be cool.
|
|
|
|
|
I think you can do it via SSIS? If not, you can always use OLEDB to pull the data and fill the SQL...
|
|
|
|
|
Now i am binding the ddl with DS which created from my table.
But it wll affect my original table,So i make another temp table having same structure of my original table and start creating ds from that with updations. So tell me some tech. that wll avoid creation of tem table as wll as hold record temporary in structures like ArrayList,RecordSet,DataTable etc.
Plz help me for that..
modified on Friday, April 11, 2008 8:52 AM
|
|
|
|
|
I am storing images in SQL server in binary format... now i want to display those images using image control.. so can any one help me for the same...
Jeevamohan
|
|
|
|
|
Image.FromStream - read the data out into a stream and then use this command to generate an appropriate image.
|
|
|
|
|
Hi All,
I have got a problem with an mdb file which is not opening.My friend has sent me one mdb file of her project. I downloaded it but it is giving a message as follows:
"The file is located outside the intranet or on an untrusted site.MS Access will not open the file due to potential security problems.
To open the file copy it to your machine or an accessible network."
Please solve my problem as it is very important for me....
Thank You
Gayatri
|
|
|
|
|
|
|
I'm Using Asp.Net with C# & SSRS 2005 for Generating Reports..
I'm Having HUGE Data in Microsoft Excel Sheets .. I want to Get this Data from this Microsoft Excel Sheets & to Generate REPORTS in SSRS 2005..
Please give me the Suugestions for Doing this..
Thank You..
|
|
|
|
|
Good Morning All
i have the Following quey,that i want to put their results into a table like this
SELECT DISTINCT(SS.FUNCTION_KEY),P.FUNC_KEY,P.PROPERTY_ID,SS.LIS_KEY,P.LIS_KEY,SS.FLOOR_AREA,P.ACTUAL_EXTENT<br />
Into Final_Area_GEOSS FROM SDE.PROPERTY P INNER JOIN Scheme_Area_GEOSS SS ON<br />
P.LIS_KEY = SS.LIS_KEY AND SS.FUNCTION_KEY = SUBSTRING(P.FUNC_KEY,1,5)+'0'+substring(P.FUNC_KEY,6,3)<br />
WHERE P.FUNC_KEY LIKE 'GEOSS%' <br />
order by ss.lis_key,p.lis_key
when i run this Query i get an Error that says
Msg 2705, Level 16, State 3, Line 1
Column names in each table must be unique. Column name 'LIS_KEY' in table 'Final_Area_GEOSS' is specified more than once.
i understands what it mean, but it does not matter how many lis_key repeat itself, as long as that data gets into the table.
how can i achieve that
thanks
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
|
|
|
|
|
Your problem is you cannot have duplicate column names in a table - obviously - and in your query you select SS.LIS_KEY twice. You need to alias one or both of them for example:
SELECT DISTINCT(SS.FUNCTION_KEY),P.FUNC_KEY,P.PROPERTY_ID,SS.LIS_KEY as Geoss_LIS_KEY,P.LIS_KEY as Property_Lis_Key,SS.FLOOR_AREA,P.ACTUAL_EXTENT<br />
Into Final_Area_GEOSS FROM SDE.PROPERTY P INNER JOIN Scheme_Area_GEOSS SS ON<br />
P.LIS_KEY = SS.LIS_KEY AND SS.FUNCTION_KEY = SUBSTRING(P.FUNC_KEY,1,5)+'0'+substring(P.FUNC_KEY,6,3)<br />
WHERE P.FUNC_KEY LIKE 'GEOSS%' <br />
order by ss.lis_key,p.lis_key
That will fix your problem.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
You are a Star my man,
thanks it works
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
|
|
|
|
|
Thats OK. By the way, you should not do it this way as it locks the system tables in the database for the duration of the query. That prevents any other queries using them and could have a big perforamnce hit.
I would do it like this
SELECT DISTINCT(SS.FUNCTION_KEY),P.FUNC_KEY,P.PROPERTY_ID,SS.LIS_KEY as Geoss_LIS_KEY,P.LIS_KEY as Property_Lis_Key,SS.FLOOR_AREA,P.ACTUAL_EXTENT<br />
Into Final_Area_GEOSS FROM SDE.PROPERTY P INNER JOIN Scheme_Area_GEOSS SS ON<br />
P.LIS_KEY = SS.LIS_KEY AND SS.FUNCTION_KEY = SUBSTRING(P.FUNC_KEY,1,5)+'0'+substring(P.FUNC_KEY,6,3)<br />
<big>WHERE 1 = 2 </big>
which creates an empty table (almost) instantly, and then
<big>Insert Into Final_Area_GEOSS </big><br />
SELECT DISTINCT(SS.FUNCTION_KEY),P.FUNC_KEY,P.PROPERTY_ID,SS.LIS_KEY as Geoss_LIS_KEY,P.LIS_KEY as Property_Lis_Key,SS.FLOOR_AREA,P.ACTUAL_EXTENT<br />
FROM SDE.PROPERTY P INNER JOIN Scheme_Area_GEOSS SS ON<br />
P.LIS_KEY = SS.LIS_KEY AND SS.FUNCTION_KEY = SUBSTRING(P.FUNC_KEY,1,5)+'0'+substring(P.FUNC_KEY,6,3)<br />
WHERE P.FUNC_KEY LIKE 'GEOSS%'
to populate it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks it worked.
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
|
|
|
|
|
interesting... could you please let me in on a secret how this works? it is techniques like this i would like to know... TIA!
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
While you are creating a table, either with a 'Create Table...' or 'select * into ...' the system objects such as syscolumns are locked. Obviously while they are lcked no-one ele can create a table. This is particularly apparent where you have a 'select * into #table from ...', tempdb is effectively locked for the duration of the select.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Cheers!
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
I want to get two columns data from two tables which are not dependent to each other i.e. no key common in both they are not related to each other.
I can't use JOIN because it needs where clause which uses a common field from both tables.
I just want one column from one table and one column from another and display it.
how can do it?
some unions or any other syntax for that?
Thanks in advance,
|
|
|
|
|
If there is no dependency between the two tables why do you want to bring back this way?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am not sure what you want to do. Do you think a cross join will give the results that you need?
Mehroz
|
|
|
|
|
hello there,
i have a table that have a column, thats values will always unique, that column data will be in numbers, now i wanna know that what variable should i use, bigint or nvarchar ??
this column will be use in checking(i.e. is this ID exist or not?) and that table have already a PK.
currently i'm using bigint and i think that bigint is taking more space than a string, just a think, cant say surely....
so please suggest about it with a good reason
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen wrote: currently i'm using bigint and i think that bigint is taking more space than a string, just a think, cant say surely....
Perhaps, if your number is low currently. But, if the number gets big, that will reverse. if you're doing indexing on this id ( which seems the only reason to have it ) a number makes far more sense than a string.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
now i wanna know that what variable should i use, bigint or nvarchar ??
It depends on what's the maximum value you expect in the column. I suppose that you'll never run out of numbers in Bigint unless you handle a billion transactions a day.
currently i'm using bigint and i think that bigint is taking more space than a string
Every character in a nvarchar column occupies 2 bytes. So if you're column is nvarchar(10), it'll occupy 20 bytes of storage(Assuming that the data is 10 characters long). On the other hand, Bigint is 8 bytes for all values in the range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. (thats a lot of numbers)
so please suggest about it with a good reason
One good reason is that a fixed length columns is that indexes will work better on them. Use a bigint type and index it for faster performance of your EXISTS query. If the column stores only numbers, use a suitable numeric datatype. The performance will far offset storage.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|