What is the proper syntax for using the exec('sql statement') inside of an update statement?
I have an update statement like this:
update #tmp_tbl set
field1 = (exec('select ' + (select fieldname from fieldnametable where category = id) + ' from datatable where trans_id =...
My hard drive crashed, and I had many songs from iTunes downloaded. I have another computer,with iTunes installed, and want to redownload my songs from apple, but apple wants $50 to start troubleshooting. Someone may know how to download my songs again. I have no iPod, and everything on the...
Here is what I ended up doing:
I created a UDF, that returns a table, that returns the same recordset as the stored procedure I was trying to execute. Then I used the following syntax;
select * into #table from dbo.udfname(param1,param2)
Using that methodology, it works like a champ.
I want to insert the results of a stored procedure directly into a temp table. Is there a way to do that without first declaring the temp table? Using TSQL, you can do it like this;
select field1, field2, field3
into #table
from tablename
If I try to do this:
exec storedprocname param1...
Well, sorry to say, but that didn't help me. It looks like the recordcount method isn't very reliable. I tested your code on a stored proc that definately returns a recordset, and it gives me a value of -1. Also my stored procedure accepts two parameters....both integers.
I have a stored procedure that I need to know how many records were returned in the recordset. I have been reading up on the recordset.recordcount method, but everything seems to be for inline sql, not stored procedures. Any help is appreciated. Thanks.
I would like to thank both of you for your help. Rdroske, that looks like a pretty cool thing, knowing what statement caused the trigger to fire. That may be useful to me down the road.
I have a trigger that saves any changes made to one table in our database, to another table, just for historical backup purposes. The trigger works just fine, but the only problem is if I run a bulk update statement in Query Analyzer. I get a "Subquery return more than one result"...
I do use the exec (@String1) statement at the end of the procedure. The temp table I use works perfectly. The only problem I have is when I try to call the temp table after I have executed the string.
declare @string1 varchar(8000)
set @string1 = '
create table #table1
(...
I have a stored procedure, that I build a temp table, using a string. The reason for building the temp table in a string, is I have a dynamic number of columns, depending on how many metrics a user selects. This string built table is the first of many temp tables to be utilized in this stored...
I have a UDF that takes a CSV, and puts each value into a temp table, and gives it an incremental value. So a string "3,6,9", will look like this;
Id Value
1 3
2 6
3 9
What I want the UDF to do, is using the @Id parameter in the UDF, select out the row that matches...
Okay, I have found this UDF, that takes a CSV, and breaks out the values into a temp table, so "2,4,6" would look like this:
2
4
6
Now, what I want to do, is add a value field, that will increment by one, so the above row would look like this:
Value Field
1 2
2 4
3 6...
In the database, there is a table that has a text-based field, with 13 values, seperated by a comma, and then a space. The field will look like this, minus the quotes:
"1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13"
The numbers won't always be 1-13, they can be anything, but you get the...
I have an operation I want to perform in a stored procedure. I am building a temp table that gradually gets larger. Now, what I want to do is this;
I have found some literature on the "while" statement, which sets a condition for a chunk of SQL to be repeated until a condition is...
I was able to run the query with an active server page. Although, if anyone wants to help with encapsulating what I asked above into a stored procedure, or some type of view, that would be great, also.
I have a table that is structured like this;
Table1 (
Id Int Not autonumber
RecordNumber Int autonumber Primary Key
AcctNumber Int
Quantity Int
Length float
Width float
Height float
Type int * determines the type of storage (bay, shelf, or...
here is how we used to do refreshes of the parent screen upon closing a popup. This code is in the popup window page, not the parent webpage.
function RefreshWindow()
{
opener.location="pagename.asp";
window.close();
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.