See each of the steping through few rows to see how data gets appe

Hi,
I have the stored proceure as bdlow.
However I would like to watch how each of the rows is getting inserted to 
the table 

Is there any print statement or anything else that will let me see the 
insertion?
Any help is appreciated. Thanks

CODE:
ALTER procedure machine_hrs_sp

AS
declare @test table (machine varchar(25), plan_date datetime, plan_hrs int)
declare @machines table (machine varchar(25))
insert @machines
select '01' union all
select '02'

declare @days int
set @days=0
while (@days < 365)
begin

 insert @test select machine,dateadd(dd,@days,'20100101'),16 from @machines
 set @days=@days+1
end
select * from @test
0
Utf
1/29/2010 6:00:01 PM
sqlserver.programming 1873 articles. 0 followers. Follow

2 Replies
913 Views

Similar Articles

[PageSpeed] 7

You can use the OUTPUT clause:

INSERT INTO @test
OUTPUT Inserted.machine, Inserted.plan_date, Inserted.plan_hrs
SELECT machine, DATEADD(dd, @days, '20100101'), 16
FROM @machines;

-- 
Plamen Ratchev
http://www.SQLStudio.com
0
Plamen
1/29/2010 6:17:18 PM
Thanks Plamen for your help. It worked great.
Regards.

"Plamen Ratchev" wrote:

> You can use the OUTPUT clause:
> 
> INSERT INTO @test
> OUTPUT Inserted.machine, Inserted.plan_date, Inserted.plan_hrs
> SELECT machine, DATEADD(dd, @days, '20100101'), 16
> FROM @machines;
> 
> -- 
> Plamen Ratchev
> http://www.SQLStudio.com
> .
> 
0
Utf
1/29/2010 8:08:01 PM
Reply:

Similar Artilces:

How do I reduce the number of data points I have??
Hi , I have some 10000 data points from which I need to reduce to something like 100 points before making an xy chart. Typically I would like to make a chart of every 10th point. So basically I need to reduce the length of my two rows. Is there any way I can do this easily?? Any help is highly appreciated. Thanks in advance -- swapan From the Microsoft Charting FAQ: http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=209#jon024 - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ ssan...

How to autofit row height on merged cells with wrapped text
Autofit works when wraped text cells are not merged. There doesn't seem to be a way to autofit wrapped cells when the cells are merged. One way that I think may work would be to use a macro to set the row height, but I can't figure out how many lines the text will occupy in the merged cell. Any ideas out there? If you search the archives: http://google.com/advanced_group_search?q=group:*excel* you'll find that one way is to use a macro by Jim Rech: http://google.com/groups?threadm=e1%241uzL1BHA.1784%40tkmsftngp05 In article <6d0401c3e685$a6146860$7d02280a@phx.g...

why am i getting 4 emails the same
I am using microsoft outlook and have 4 email accounts using blueyonder and am getting 4 emails the same how can i stop this Does BlueYonder put all the accounts email into a single POP3 mailbox? Outlook can't sort that out if it is that way automatically "peteatspurs" <peteatspurs@discussions.microsoft.com> wrote in message news:7BEFCF99-A933-4BA6-BBAD-BD0CEA14BB09@microsoft.com... >I am using microsoft outlook and have 4 email accounts using blueyonder and > am getting 4 emails the same how can i stop this "Vince Averello [MVP-Outlook]" wrote: ...

I cant see emails coming in anymore.
I used to push send/receive and a box would come up telling me 'Receiving 8 of 40 emails' with a green bar going across the centre. Once the emails are received the box goes. If I push send/receive nothing happens. If I push it say, 10 times, again nothing happens. Once all the emails are thru the box that used to come up, than flashes up 10 times, but by than its a little late. Does anyone know how to get the box back? I would really appreciate it... KR Mick. I send this message using the forward procedure to somebody of the group My problem is likely the same as a lot ...

Create individual files from a row
I have an excel file with several thousand entries, which contain data in several columns. I would like to be able to create an individual xml or html file for each row, but with predifined formatting around so Mr A bloggs, A street, A town, AA1 1AA Could become Abloggs.html <head></head> <name>Mr A bloggs</name> <street>A street</street> Any other info here as well </html> etc. Is this possible and any suggestions how? thanks, Graham. -- GrahamN ------------------------------------------------------------------------ GrahamN's Profile: ...

Locate Value in a set Row, with Dynamic Column
Hi, I have some data and the headers for the numbers are months. All the months are on row 7. I need to add some code to start looking in row 7 (cell A7) and look at each column to locate the relevant date entered in cell A1. Example: The code needs to look at cell A7, then B7, then C7 etc etc until it locates the right value. How can I do this please? Thanks, What do you want thew code to do when it finds the match? "Louise" <Louise@discussions.microsoft.com> wrote in message news:33D451C1-3C5D-4C5C-BD65-1D85139BBC0B@microsoft.com... > Hi, &g...

Getting error "selection is too large" when copying data
I was copying multiple cells to other rows in my spreadsheet and I received an error "Selection is too large". I have never received this before and I have had some huge spreadsheets... ...

Is there a way to insert a copied row into all aother tabbed table
I have a file with about 100 tabs along the bottom for other tables. I have a row that I need to copy and insert into each one of those (at the top, first row). I can copy and insert row into each tab individually but is there a way to have this insert into all of them at once in the same place? Yes. Group the sheets. For Excel help on how to group sheets, type "group sheets" into Excel help. -- David Biddulph "Greg" <Greg@discussions.microsoft.com> wrote in message news:09E31216-B19F-44F2-BEA2-8F913BA1ABB5@microsoft.com... > I have a file w...

Not able to see all data but can see on another computer
Hi, I am using SAP application and if i retrive the excel file from SAP i can see only 48 lines where as i should see 110 lines but if i opened that same excel file in another computer then i can see all lines (110 Lines) i don't know why its happening. Can anyone help on this? Thanks in advance. Regards, Harish ...

External Data wont refresh on a prtected and shared workbook...
I have a workbook that is used by multiple people over a network. In this workbook I added some data from a site that i wanted refreshed everytime the workbook is opened. I found out i can't protect the worksheet or protect and share the workbook and still have it refresh the data. Is there a way to protect/share the workbook (due to code inside the book) and still have the external web data refreshed upon the book opening ...

Getting data into Excel cells for OLE objects retuened from Access
Hello all, I have a MS Query in Excel filtering and retrieving relevant data from MS Access. When the data returns, all BUT the column which refers to a OLE object datatype in Access returns values. What should I set the format in Excel to see the OLE objects dynamically. Thanks AFAIK, that is not possible. Sorry. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article <0dce01c3db7e$ba637bb0$a301280a@phx.gbl>, anonymous@discussions.microsoft.com says... > Hello all, &...

Query to Access : does'nt see tables
Office 2000 SP3 FR From Excel / MS Query, I want to read data in Access tables. I choose the mdb file and so MS Query displays this error message (translated) : "This data source does'nt have any visible table". Original in French : "Cette source de donn´┐Żes ne contient aucune table visible." I transfert my data to a new mdb file : it work's few times (!), then the error message appears again. How to resolve this problem ? Jacques. Gotcha ! MS Query does'nt accept a file name with 2 dot inside ! Example : MyFile.mdb --> Ok My.File.mdb --> "...

create a letter with the data fron work sheet
i have a data sheet for the order.like people order staff lik tea,coffee...etc,i ve data including date,name,department,.....etc. when i put the data i want a letter format which picks up the data fro the sheet then i can send it to the person who made the order as confirmatino letter. like it the letter starts dear "......"(it could pick the name fro c1) also how can i create this letter? does it have to be in excel ?? help pleaseeeeeeeeeeeeeeeeeeee!!!!!!!!!!:( :( :( : -- Message posted from http://www.ExcelForum.com As answered in microsoft.public.excel and microsoft.public....

lookup row number
Hi, can you tell me how to lookup the row number of a name in a list. EG say I have a list of names as below: Andrew Mike Steve Ian Paul I would normally just add a column with the row numbers and then lookup the row number in the second column but is it possible to do without adding the extra column by using the row formula someohow? Thanks Hi Michael Try the below.. =MATCH("Mike",A:A,0) -- Jacob (MVP - Excel) "Michael" wrote: > Hi, > can you tell me how to lookup the row number of a name in a list. > > EG say I hav...

Multiple row insertion on various worksheets
Need to be able to add row to Sheet1, and at the same time add a row to Sheet2 at a certain off sett row. Then if possible populate both new row with what is in the row above in the same way as would occur using the autofill pull down. Thanks Shaun If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Guillett M...

How to see my mail queue?
Hi there, I have a Exchange 2000 running on Windows 2000 server. Could you please tell me how to monitor my emails in my mail queue? I can't find a location on the Windows to see the mail queue status. Thanks in advance, Ross To view the mail queues follow these steps: 1. Open system manager, Navigate down to the following location Your organization --> Administrative groups --> Your Admin group --> Servers --> Your Server --> Protocols --> SMTP --> SMTP virtual server --> Queues You should then see all the smtp queues and monitor mail. thanks, J. ...

updating seperate spreadsheets with same data
I have seperate spreadsheets, one with monthly numbers and one with yearly numbers. how would I go about updating a clients info in the monthly spreadsheet and getting it to update in the yearly spreadsheet without having to go in and manually copy/paste? Take a look at using 3d references in the XL help file. Perhaps something like: =SUM('Jan:May'!A2) -- Best Regards, Luke M "T" <T@discussions.microsoft.com> wrote in message news:85C3C803-57A4-4DA2-AA04-71D8B0EFAE30@microsoft.com... >I have seperate spreadsheets, one with monthly numbers and o...

Anyway to join between two different data types?
Hi all, I have a Access database that is linking to Oracle tables. I need to join on two different data types. Number and Varchar2. With a oracle query, it is easy: one can simply put a to_char on the number data type. So: select * from invoice i, comment c where to_char(i.invc_id) = c.reference_id However, I can't see any way to do this with the Access query (in either Design View or SQL View). Is this possible? This will be slow, but have you tried using one of the conversion functions select * from invoice i, comment c where (i.invc_id) & "&q...

How can I get data from one worksheet into another exsiting worksh
Here is my case: I already have 2 worksheets both include 2 columns: Cell & Site Name. WorkSheet A includes all the cells and site names; WorkSheet B includes only a small portion of Cells. Now what I need to do is to get the site name for each cell in worksheet B. I don't want to manually copy & paste. Is there any way to speed up? Thanx! Cell Site Name T50MB7 T73MA7 T73MA8 T73MA9 T04MV9 T04MW7 T34MK7 T34MK8 T51ME1 T51ME2 T51ME3 T04MV1 T34OR2 T34OR7 T34OR8 Sabrina, you can use the VLOOKUP formula to fill in your Site Names in Worksheet B. Example: =VL...

Output the list of frequent data
Dear all, Here comes two problems. Problem 1: I have a list of strings (say, in the column A1:A100). How can I find the "mode" (i.e. the string appearing most frequently in the list? For example, if the list is APPLE APPLE BANANA APPLE CREAM CREAM BANANA CREAM APPLE DONUT then I want the result is APPLE. It seems that the MODE function does not suppot data type other than numbers. Is there any canned UDF for it? Problem 2: Following Problem 1, I want to generate a list of the 3 most frequent data in the list. If the list is the one in the example, I want to list to be...

Changing row color in a grid
Hi all! Is it possible to change the background color of a grid row in a view, based on a field value? I would like to qualify opportunities as hot (red), medium (yellow) or low (gren). Thanks for your input on this, -- Jenny :) It can be done, in lots of fairly unsupported ways mind: http://blog.odynia.org/categories/3-Microsoft-CRM The supported way forward is to use SRS Reports and a Dashboard (either through MSCRM's ISV.Config, or Sharepoint) to build your own view, this gives you a supported solution with considerable more freedom on the appearance however involves much ...

I see you
Well, not really, but I used Google Earth to zoom in on the Flatiron Building. You can get so close you can see the utilities on the roof, the hydrants on the street, the little parkish area across 5th Avenue, etc etc. Cool! Now tell me where your office is (like where is Peter's window, what floor and facing what street). Google Earth lets you zoom in all directions so I'll be able to turn the map to see that window. Silly I know but still a connection on some level. Pats looked good but not great last night. I didn't watch much more of the game. I'm not sold on ...

Data Selection
Fellow Excellians, I need a little help Picture my screen I have 16 teams and about 12 to 15 people per team Cell C1 TO C100 Contains Various Team Names Cell D1 to D200 Contains peoples Names In Cell A1 Contains "Team Name" in Cell A2 i want to select a person from the list i have created in C1 & C2 but it needs to filter out only the people that play for that team selected in A1 Anyone Got any idea's Thanking so much in advance Steve ...

Extender Data is not showing in Smartlist Payable transactions
Hi, I have a System Sub Smartlist under payable transaction smartlist. some companies are showing data and some not for the column which is coming from an Extender. can anyone tell me the workaround. Thanks ...

Data searching between sheets
I want to make language libruary where I can retrieve all my past entries in tow different sheets. When I type keywords into the self-made searching box, the corresponding results will show up. (Not excel built-in search function Ctr-F please!!!! ) Anybody out there can give me direction where should I get started?? Please Help!!! Thanks -- YJL ------------------------------------------------------------------------ YJL's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28693 View this thread: http://www.excelforum.com/showthread.php?threadid=483778 Hi YJL,...