|
OK your slightly unclear here.
You can create a new datatable in your current dataset and "copy" the data from the dataview in there.
or
Create a new dataset, create a new datatable in the new dataset and you guessed it "copy" the data from the dataview in there.
DataSets are collecton holders of Tables, Views etc.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
Hi Everybody,
I have a problem with the ADO.NET Connection which i use in my coding in VB.net 2005, to connect to the SQL Server 2000.
This connection works properly on a local machine , when i set the servername as localhost. but when i set the servename as the name of the server on which the SQLServer is installed, it doesn't work. whereas the ADO Connection does.(Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=" & ServerName)
The ConnectionString I'm using is "Data Source=" & ServerName & ";Initial Catalog=DatabaseName;Integrated Security=true"
Thanks, in advance
Regards,
Myra
|
|
|
|
|
|
hi,
the error is :
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
Regards,
|
|
|
|
|
|
the connection timeout is equal to 15.
but how can I manage this error?
thanks,
|
|
|
|
|
|
thanks a lot for you.
I tried to add to the connection string : "Connect Timeout=30", and it worked.
|
|
|
|
|
I have two table with one-many relationship
table1 has 2 fields:type(int,PK),name
table2 has 4 fields:id(PK),type(int,FK reference field type of table1),content,shortDesc
How to write a SELECT statement that return rows from table1 join table2(via type field) but each row has a different value of type.
Result example:
--------------------------------------------------
| table1.type | name | content | ShortDesc | <--- FIELDS NAME
--------------------------------------------------
| type1 | name1 | content1| shortDesc1 | <---VALUE( ROW )
--------------------------------------------------
| type2 | name2 content2| shortDesc2|
Can anyone help me.Thanks in advance
|
|
|
|
|
|
Sorry but the statement don't return what i expected
Example:
type1 |Id1 | name1...
type1 |Id2 |name2...
because there's a one-many relationship between 2 table
Thanks anyway
|
|
|
|
|
ali33 wrote: Sorry but the statement don't return what i expected
However, it does return what you asked for.
You asked for: | table1.type | name | content | ShortDesc |
The SELECT statement returns: table1.type, table1.name, table2.content, table2.shortDesc
name only exists on table1, content and shortDesc only exist on table2
You are now asking for something with an example output of:
type1 |Id1 | name1...
type1 |Id2 |name2...
This is not possible because name is on table1. Therefore any output row that contains type1 must also contain name1. An output row containing type1 cannot contain name2
ali33 wrote: because there's a one-many relationship between 2 table
Yes, I know that - That is what I gave you. I suspect that either you did not give the full information when you asked the question or you do not understand the implications of the join scenario.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
oh!sorry . I have a mistake
When I run your SQL statement the result return is:
type1 |Id1 | name1...
type1 |Id2 |name1... <---(sorry not name2)
But the result I expected is:
type1| Id1 |name1...
type2| id2 |name2...
type3| Id3 |name3....
(each type return only one ID of table 2,for all type)
Sorry for the mistake and can you help me.Thanks
|
|
|
|
|
|
Colin Angus Mackay wrote: Sorry, but I'm still convinced my SQL is correct.
Show me an example of a few rows from each table that should match and tell me for each row in table1 what rows in table2 match to it.
here is an example of some rows from each table:
table1:
|type |name |
----------------------------
| 1 | type1 |
----------------------------
| 2 | type2 |
table2:
|id |type | content | shortDesc |
---------------------------------------------
|1 | 1 | content1 | desc 1 |
|2 | 1 | content2 | desc 2 |
|3 | 2 | content3 | desc3 |
|4 | 2 | content4 | desc4 |
|5 | 1 | content5 | desc5 |
The expected result :
|id | table1.type | name |content | shortDesc |
-------------------------------------------------
| 1 | 1 | type1|content1 | desc1 |
| 3 | 2 | type3|content3 |desc3 |
each type returns only one row.
So now can you help me.If you need,i 'll send you my database and the description more clearly.
Thanks.
|
|
|
|
|
I see now. You need to aggregate the rows in table2 somehow then join it. However there is no natural aggregation that you can use. From your example result set you appear to be taking the lowest id for each type - so that is the colum that needs to be aggregated.
This is the aggregation component:
SELECT MIN(id) AS id, type
FROM table2
GROUP BY type It basically takes the first row for each type and discards the rest.
Now it has to be joined up. The result of the aggregation is added to the previous join to act as a filter.
SELECT table1.type, table1.name, table2.content, table2.shortDesc
FROM table1
INNER JOIN table2 ON table1.type = table2.type
INNER JOIN (SELECT MIN(id) AS id, type
FROM table2
GROUP BY type) AS filterQuery ON filterQuery.id = table2.id This should now produce the results that you want.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
wonderfull!It run perfectly.Thanks Colin Angus Mackay
Best wishes!
|
|
|
|
|
Hi ALL,
How to find 4th working day(any for tht matter) of
any month...If for ex. For June 2006, the 4th working day is
6th June. So, i need to write a PL/SQL(or even SQL Query is also fine) to obtain tht particular day.
Plz do the needful.
Regs,
Jazzy
|
|
|
|
|
|
Hi,
Im trying to get the records from excel sheet to sql server table.
pls help me..getting some errors..
--------------------------------------------
@file_name varchar(255)
as
begin
--select @file_name = DOCUMENT_PATH from DOCUMENT
SELECT @file_name =(' \\ZSW125\AON\BatchProcessing;HDR=YES ')
--Get the excel filename & path to be imported from the reference table
declare @strsql varchar(500)
set @strsql = 'select * from openrowset(''Microsoft.Jet.OLEDB.4.0'',
''Excel 8.0;Database=' + @file_name + ';HDR=YES'', ''"
select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database='\\ZSW125\AON\BatchProcessing;HDR=YES','')
|
|
|
|
|
Hi,
Please anyone can help me for finding a word from a particular field from table in database of SQL.
I have the problem below.
DataTable Name: TempTable
Field name: Dtail
other field name: KeyWords
in the Detail field i have data like:
<--Begin-->
(TenderProcess <> 'Sell' and (State in ('Gujarat') and (ProductName in ('Iso-9002 Consultancy','Audit') or ProductDetails like '% ISO %' or ProductDetails like '% ISO- %' or ProductDetails like '% ISO - %')))
<--End-->
Above is the data in field of Detail Now my Question is:
I want to get words if it found the word 'Product Detail like%%'in any record.
Then for above ex. if I found the word it give
output:ISO,ISO-,ISO -
------------------------------------------------------------
So from above ex. I how I get the output as above.
Please help me.Reply me urgently.
Jesal
OK
|
|
|
|
|
|
I originally developed my application using SQL 2005 Developer Edition, but want to switch to using an XCOPY deployed DB on SQL Express for deployement.
I have successfully copied the database.mdf/ldf files over to me project, and can connect using Data Source=.\SQLExpress and AttachDbFilename=|DataDirectory|\[database].mdf attributes.
The question is, how do I enable CLR integration for my C# SP's?
I've tried executing the following in various places:
sp_configure 'clr enabled', 1
go
reconfigure
go
But I obviously haven't hit the spot because I'm getting the following error when VS deploys my SP library:
Error: starting database upload transaction failed.
Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Any ideas?
|
|
|
|
|
I have an existing SQL table with no constraints. The PartID and DescriptionPartID need to be a composite key. I check and there are currently no duplicates in the existing table. Can I create the key now by doing the following:
UPDATE TABLE Descriptions
PRIMARY KEY (PartID, DescriptionPartID)
Thanks!
|
|
|
|
|