|
Actually what I meant is that I want to use the stored procedure to populate the table. I already found a way:
CREATE @TmpTable (ContactID INT, ContactName NVARCHAR(36))
INSERT INTO @TmpTable EXEC dbo.GetContacts
SELECT * FROM @TmpTable
Thanks all the same.
|
|
|
|
|
<br />
CREATE TABLE #TEMP (ContactID int, ContactName varchar(50))<br />
<br />
INSERT #TEMP<br />
EXEC dbo.GetContacts<br />
<br />
SELECT * FROM #TEMP<br />
<br />
|
|
|
|
|
create Function [dbo].[MyFun] ()
Returns @tbl table (id int,Item varchar(100))
as
begin
insert into @tbl
SELECT ContactID, ContactName FROM Contacts
return
End
then use this
insert into temporary table/permanent table
select * from MyFun()
Manu
|
|
|
|
|
Hi,
This is closely related to my previous question BUT ...
I go through a web log file and extract each line and put the data into a new row in a datatable.
I then change the data in one field of each row.
I then use that datatable as my source for extracting various statistics.
At no time do I really need to save the datatable to the underlying database as far as I can see.
If I don't need to save the datatable to the database, do I really need to do a datatable.update let alone a dataset.acceptchanges?
Glen Harvy
|
|
|
|
|
If you only need to use the DataTable object as an in-memory repository for data, then you don't need to use these methods. They are used for synchronising the contents of the DataTable with an underlying database.
Paul
|
|
|
|
|
Thanks for that - it's funny how I have never stopped to think about what I was doing until performance became an issue. Suppose this is often the case now that I think about it.
Just one thing more though...
Is there any need at all to call dataset.acceptchanges() if you have just done a datatable.update and you know there hasn't been any other changes to the datatset.
Logically the answer is no but I just want to confirm that.
Thanks for your time.
Glen Harvy
|
|
|
|
|
I don't do this kind of stuff with DataTables very often, but according to the MSDN documentation...
When AcceptChanges is called, any DataRow object still in edit mode successfully ends its edits. The DataRowState also changes: all Added and Modified rows become Unchanged, and Deleted rows are removed.
So I think you should call AcceptChanges after Update to reset the status of the rows in your DataTable.
Paul
|
|
|
|
|
Yep - I agree with you.
Thanks.
Glen Harvy
|
|
|
|
|
Hi,
I have developed the habit of coding new rows etc as follows:
DataRow nr = DataSet.Tables[logName].NewRow();
nr["c-ip"] = appField[0].ToString();
nr["cs-username"] = appField[2].ToString();
this.DataSet.Tables[logName].Rows.Add(nr);
this.TableAdapter.Update(DataSet.log1);
DataSet.AcceptChanges();
Performance has raised it's head and I am wondering now why I am calling DataSet.AcceptCahges() .
Is this necessary in this instance?
Does AcceptChanges actually do anything?
Glen Harvy
|
|
|
|
|
Whilst analysing one of my stored procedures, I was curious on investigating whether there are any associated (latent/deliberate) pitfalls associated with respect to RECURSIVE Stored Procedure. From my side, I have ensured the following:
1) Currently, I have as much fine drilled the WHERE clause so that as narrowed down records as minimal are only selected for delete operation.
2) No Temp Tables have been used to prevent any deadlock even whilst entering into them.
3) From my personal preference, CURSORS are a big no-no considering the huge performance and penalty that we ought to pay for through our nose.
Should I consider any more option to ensure that it does not penalize my database for any performance issues?
|
|
|
|
|
Temp tables can infact speed up a stored procedure if there is a lot of joins in a particular select statement.
|
|
|
|
|
Dear friends,
I want to put name and leavedescription on the y axis and date on the x-axis how to do that in chart in sql report designer?
It gives me error like "more than 1 data set, dataregion, or grouping........."
I am trying this with line chart.
Plaese guide me!
|
|
|
|
|
Hai Everybody,
I have an table, in that i haven't set the primary key as a identity field.
No i want to set the primary key field to have an identity constraint without dropping column.
Either I can drop the column and add it again or else suggest me an alternate as i have given the database to the client i can't change using the GUI.
I want the script to perform the above.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Create a sample table with the same definition and dump the records. First try to set the Primary key field to have an Identity Constraint without dropping the column. It will set the Key but the Identity seed will increase from the max value that column contains and the records will also rearanged in the order of the Identity Value. Check you application whether it runs properly with these changes. and How sure are you that these change doesn't causes any negetive impact on the application side? Because It completely depends on how that particular field is handled on the application side (Including DataDefinition). At present How the value is being passed to this field from the application? If constraint changes will that create any problem?
Since Pkey is not set to that column it might have not been referencing any other table. But still dropping that column depends how that particular feild is handled on the application side. Consider all these factor and take the neccesary action...
do the verification testing before you do changes to the production database.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Hi ..
thanks for all here ..
on my example .. I want to save the image of a PictureBox to the Sql server 2000 database ...
I know how cant save it from a file ...
but I want to know how save the PictureBoc's image ...
jooooo
|
|
|
|
|
please i want a website which demonstrates the travel agent system showing their database design and relational tables
thanks
|
|
|
|
|
dinakatina wrote: i want a website which demonstrates the travel agent system showing their database design and relational tables
You are most unlikey to get this unless someone has used a travel agent system as an example in a text book.
Have you considered designing your own database?
|
|
|
|
|
Hi All,
I need to do a select statement with will combine two fields into one before I do the Like statement.
i.e.
Table1.SuiteNumber
Table1.Address
Table1.Country
Combine these 3 fields into one field called FullAddress
Select suitenumber + " " + Address + " " + Country AS FullAddress From Table1
THEN select particular record in the FullAddress field
Select * from Table1 where FullAddress like %Owl street%
How can I combine this two select statement into one? Please advice. Thanks in a million.
gsdg
|
|
|
|
|
SELECT suitenumber + ' ' + Address + ' ' + Country AS FullAddress
FROM Table1
WHERE suitenumber + ' ' + Address + ' ' + Country LIKE '%Owl Street%'
|
|
|
|
|
Alternatively
SELECT *
FROM (SELECT suitenumber + ' ' + Address + ' ' + Country AS FullAddress
FROM Table1) AS subquery
WHERE FullAddress LIKE '%Owl Street%'
|
|
|
|
|
i design a website about online reservation systems in travel agents ,and i face many problems database design stage one of these problems is how to display the description of the day for (certain day of certain package)
the second problem if an individual reserve online and fill the reservation form (without going to an agent that exists in his country )should i put him/her in a filegroup or not
if anyone is familiar with tourism fields and its system,please give me advice,i need it urgently,thanks a lot
|
|
|
|
|
dinakatina wrote: how to display the description of the day for (certain day of certain package)
That is an ASP.NET problem.
dinakatina wrote: if an individual reserve online and fill the reservation form (without going to an agent that exists in his country )should i put him/her in a filegroup or not
I don't know. What does your client want to happen in that situation?
|
|
|
|
|
Gotta love the people who 'need it urgently', but don't respond when you try to help.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Gotta love the people who 'need it urgently', but don't respond when you try to help.
It happens. I'm trying not to lose my cool with that sort of thing, so the odd vent on my blog helps. I'm actually trying to vent more frequently so it doesn't build up. Of course, that makes less fireworks for everyone else to see.
|
|
|
|
|
Is this a real world system ?
dinakatina wrote: if anyone is familiar with tourism fields and its system,please give me advice,i need it urgently,thanks a lot
I can only assume that you've taken a job to write this system, the real question is, why are you asking us what your client wants, instead of asking your client ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|