Showing posts with label filling. Show all posts
Showing posts with label filling. Show all posts

Tuesday, March 27, 2012

Filling up ListControl from a SQL query

Hello,

I use MFC ListControl. Is there any way to fill it up using SQL query without adding one row at a time?

All I could find was m_List.InsertItem(...) and m_List.SteItemText(...)

Are there any other ways?

Thanks

One possible way to do this is using virtual listctrl:

Fill(insert) the list items with bound data addresses first, then do SQL fetch for the result.

|||

Thanks a lot for the reply.

Could you give me an example of how to do that or point me to where I can read about it. Thanks again

|||

Following link maybe helpful

http://www.codeproject.com/listctrl/virtuallist.asp

Filling transaction log

Hi Guys,
I've a problem regarding transaction log, i have a databasse
which is to be accessed very rairaly inspite of that after few days it shows
warning as:
APPROACHING RESOURCE LIMIT
MSSQL Quota DB: ABCD_database has used 66 MB out of 80 MB limit
while i don't have control on my DB some other company takes
care of my DB operation like truncating transaction log etc. when i talked
with them they said that transaction log auto truncates several time in a day.
i don't know where the problem exists,
please help me
They should define "auto truncate". Auto shrink is different from backing
up the log or having the recovery model set to simple.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada tom@.cips.ca
www.pinpub.com
"Manish Sukhija" <ManishSukhija@.discussions.microsoft.com> wrote in message
news:BCCE0C43-64CC-4FF2-92A9-188B3346C6D4@.microsoft.com...
Hi Guys,
I've a problem regarding transaction log, i have a databasse
which is to be accessed very rairaly inspite of that after few days it shows
warning as:
APPROACHING RESOURCE LIMIT
MSSQL Quota DB: ABCD_database has used 66 MB out of 80 MB limit
while i don't have control on my DB some other company takes
care of my DB operation like truncating transaction log etc. when i talked
with them they said that transaction log auto truncates several time in a
day.
i don't know where the problem exists,
please help me
|||What database options are turned on? How much data is actually in the
database?
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Manish Sukhija" <ManishSukhija@.discussions.microsoft.com> wrote in message
news:BCCE0C43-64CC-4FF2-92A9-188B3346C6D4@.microsoft.com...
> Hi Guys,
> I've a problem regarding transaction log, i have a databasse
> which is to be accessed very rairaly inspite of that after few days it
> shows
> warning as:
> APPROACHING RESOURCE LIMIT
> MSSQL Quota DB: ABCD_database has used 66 MB out of 80 MB limit
> while i don't have control on my DB some other company
> takes
> care of my DB operation like truncating transaction log etc. when i talked
> with them they said that transaction log auto truncates several time in a
> day.
> i don't know where the problem exists,
> please help me
>
sql

Filling SQLDataReader with stored procedure recordset

Hi All,

I'm hoping somebody can help me with this as it is driving me mad. I've created a stored procedure which returns Employee information recordset when the windows username is passed to it as a parameter. I want to then store this information in Session variables so content can be filtered depending on employee status, but when I execute my code no records are returned. I know for a fact that the stored procedure works because I bound it sqldatasource and displayed results from it in a Datalist and tested it in sql server. My code is as follows can anybody see any problems with it, in runs through fine with but when I try a read a field from the datareader in says there is no data to read.

Dim CurrentUserAs String, Pos1As Int16, EmployeeIdAs Int32Dim cnAs New System.Data.SqlClient.SqlConnectionDim paramAs New System.Data.SqlClient.SqlParameterDim readerAs System.Data.SqlClient.SqlDataReaderDim cmdAs New System.Data.SqlClient.SqlCommand CurrentUser =CStr(User.Identity.Name) Pos1 = InStr(CurrentUser,"\") + 1 CurrentUser = Mid(CurrentUser, Pos1) Session("User") = CurrentUser Session("CID") =Nothing cn.ConnectionString ="Data Source=LAPTOP-4\SQLEXPRESS;Initial Catalog=SCMdb;Integrated Security=True" cn.Open() cmd.Connection = cn cmd.CommandText ="CurrentUser" cmd.CommandType = CommandType.StoredProcedure param = cmd.CreateParameter param.ParameterName ="@.UserName" param.SqlDbType = SqlDbType.VarChar param.Value = CurrentUser cmd.Parameters.Add(param) reader = cmd.ExecuteReader(CommandBehavior.CloseConnection) EmployeeId = reader.Item("EmployeeID") reader.Close()

Any help would be much appricated this is driving me mad.

Thank You

Shaft

To read items from reader,

reader = cmd.ExecuteReader (CommandBehavior.CloseConnection):

while (reader.Read())
{
int _employeeId = (int) reader["EmployeeID"];
}

Thanks

|||

Hi there,

If you are just reading a single value of the stored procedure I will advice you to use OUTPUT parameters to achieve this.Datareader will also do the job, but you leave yourself more vulnerable with connection not closing properly and also with overhead of creating a reader object.Just a thought.. what you are doing is also correct and will work

|||

e_screw:

To read items from reader,

reader = cmd.ExecuteReader (CommandBehavior.CloseConnection):

while (reader.Read())
{
int _employeeId = (int) reader["EmployeeID"];
}

Thanks

I've tried that all ready but it still says there is no data.

Any other ideas anyone?

|||

The actual error is "Invalid attempt to read when no data is present." so I'm thinking the Command Object hasn't pulled any data which leads me think there is a problem with the way I've declared the parameter because it is running the stored procedure just not retrieving any data.

|||

Sorry may mistake it did work I'd just forgot to comment out the statment that was wrong.

Here's the code that e-screw posted but converted to vb .net as I needed it

Do While reader.Read EmployeeId = reader("EmployeeID")Loop
Cheers E-Screw

Filling out missing data in subsequent records?

Hi

I receive several datafiles from another system that are more or less in a Excel pivot table like format.
That is the first row representing the current data is fully filled, while subsequent rows, representing historic data are left partly empty.
Current rows and historic rows have different identifiers, e.g. rectype=0 or 1
Filling out the missing data on the historic record should be simple, if only all current rows would be filled.
Some current rows aren't filled, so the stuff like the following doesn't work:
update t1
set t1.colA =
(
select top 1 t2.colA
from mytable AS t2
where t2.rowid <= t1.rowid
and t2.cola <> 0
order by t2.rowid desc
)
from mytable AS t1

Somehow I need to check for the rectype, so I don't fill out rows with data from a previous entity

Any suggestions before I revert to using a cursor?

And while we are at it: I am in for an easy way to do this for all (about 60) colums in one move?

Before you ask:
After filling everything out we process the file to arrive at a few handy fromto tables, so we can use the correct data about the entity's status at a particular point in time elsewhere

I am using MS SQL Server 2005, and solutions are allowd to use any specific trickery that MSSQL allows.

Many thanks for any constructive thoughts

Cheers

DrioWould this do the job? My changes are highlighted

UPDATE t1
SET t1.colA =
(
SELECT TOP 1 t2.colA
FROM MyTable AS t2
WHERE t2.rowid < t1.rowid
AND t2.colA <> 0
ORDER BY t2.rowid DESC
)
FROM mytable AS t1
WHERE rectype = 0

I havn't tested this code - it's only in my head (/on the screen) so don't use it on your live data ;)|||Thnak you georgev:
for the tagline (I won't do it again; a real eye-opener)
for the small correction in my code and for the direction.

It goes wrong where there are history record after the current reccord with no data.Obvioulsy they get filled from the previous current record that hadd data.

My interim solution
1. update all current records wh data with a dummy value
2. use the fill out query
We then have to check the marked records and see if we can find a pattern that allows us the handle them in code (otherwise someone has to go through them manually; only .25% of total)

Thanks for you swift response

Cheers

Drio

Filling out gaps in a date based select statement

Hi,
I have a query which simply returns a count of a particular field by w
number. My query as it works fine however for ws where there are no data
it obviously doesn't return a row. My problem is that is I wish for the
statement to return a zero for those ws with no data - I'm just not sure
how to do this.
I realise that I can achieve it by creating a table listing w numbers and
joining my query on that table. However I'd rather not create a table like
that. Is there another approach that will let me achieve the same thing?
Currently my query is:
SELECT datepart(wk, datein) AS Wno , COUNT(movementno) AS ContainersIn
STOCK stock
WHERE year(datein) = '2005'
GROUP BY datepart(wk, datein)
which returns:
W ContainersIn
29 3
31 1
34 5
35 4
36 8
37 6
38 3
39 1
40 12
Thanks,
Chris.See if this helps you
http://weblogs.sqlteam.com/jeffs/ar...09/12/7755.aspx
Madhivanan|||Why don't you want to create a table for this? I would recommend you
keep an auxiliary numbers table (a table integers from 0 to some
arbitrarily large number) for exactly such an application. A Calendar
table is also very useful to have around.
A SELECT statement can't create data out of nothing. Some other options
are: use a derived table in your query with a UNION of the numbers 1 -
52 ; create a view containing those numbers ; create a table-valued
function that returns a parameterized range of numbers ; extract the
numbers from system table(s) (not recommended). Creating the permanent
table would be my favourite - it's fast, easy, portable and much more
concise and transparent than any of the others.
David Portas
SQL Server MVP
--|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1128332658.694445.44410@.g47g2000cwa.googlegroups.com...
> Why don't you want to create a table for this? I would recommend you
> keep an auxiliary numbers table (a table integers from 0 to some
> arbitrarily large number) for exactly such an application. A Calendar
> table is also very useful to have around.
> A SELECT statement can't create data out of nothing. Some other options
> are: use a derived table in your query with a UNION of the numbers 1 -
> 52 ; create a view containing those numbers ; create a table-valued
> function that returns a parameterized range of numbers ; extract the
> numbers from system table(s) (not recommended). Creating the permanent
> table would be my favourite - it's fast, easy, portable and much more
> concise and transparent than any of the others.
> --
> David Portas
> SQL Server MVP
> --
>
Thank your for your help David - most appreciated. I guess I find the idea
of creating a new table "messy". No idea why - just something that has
always struck me as something to avoid. A habit I will have to get out of!
thanks again
Chris.

filling in missing values

I have a table that keeps track of click statistics for each one of my dealers.. I am creating graphs based on number of clicks that they received in a month, but if they didn't receive any in a certain month then it is left out..I know i have to do some outer join, but having trouble figuring exactly how..here is what i have:

select d.name, right(convert(varchar(25),s.stamp,105),7), isnull(count(1),0)
from tblstats s(nolock)
join tblDealer d(nolock)
on s.dealerid=d.id
where d.id=31
group by right(convert(varchar(25),s.stamp,105),7),d.name
order by 2 desc,3,1

this dealer had no clicks in april so this is what shows up:
joe blow 10-2004 567
joe blow 09-2004 269
joe blow 08-2004 66
joe blow 07-2004 30
joe blow 06-2004 8
joe blow 05-2004 5
joe blow 03-2004 9To have all the dealers needed:

select d.name, right(convert(varchar(25),s.stamp,105),7), isnull(count(1),0)
from tblstats s(nolock)
RIGHT OUTER join tblDealer d(nolock)
on s.dealerid=d.id
where d.id=31
group by right(convert(varchar(25),s.stamp,105),7),d.name
order by 2 desc,3,1

To have all the dates, that is something else ...
SQL Server can only base itself on what it finds in the database ...
If there is notking in tblstats (s) for that moment and you get your months from that table it will not work ...
Create an extra table (or an temp table) that will store all months and create an outer join on that table

Filling in missing data for a continous range, e.g. x-axis ..

Hi,

I want to display some stats using captured information. the x-axis is the date on which something occured. the y-axis is the number of occurance on that day.

The problem is that the x-axis need to be of continous range, so say from 1st Mar 2006 to 8th Mar 2006, I need to display every date within that range.

I've gathered the neccessary stats with a group statement but I was hoping I can fill in the gaps without having to loop through the returned data to identify missing dates, is there any built int SQL Server function which will allow me to do this within my SELECT statement?

Cheers
james
`I dont think there is such a inbuilt function available in sql server. But if you could post the ddl ,some sample data and the expected result, i m sure someone here would definately be able to help you.|||One way to do this is to enumerate the values that you need, something like:SELECT d
FROM (SELECT Convert(DATETIME, '2006-03-01') AS d
UNION SELECT '2006-03-02'
UNION SELECT '2006-03-03'
UNION SELECT '2006-03-04'
UNION SELECT '2006-03-05'
UNION SELECT '2006-03-06'
UNION SELECT '2006-03-07'
UNION SELECT '2006-03-08') AS z-PatP|||Or more generically, create a table of sequential numbers in your database starting with zero, from which you can dynamically create any sequence of dates. Like this:select XValues.XValue,
YourData.YValue
from --XValues
(select dateadd(day, SeqValue, '2006-01-01') as XValue
from SequentialNumbers) XValues
left outer join YourData on XValues.XValue = YourData.XValue|||Most times that I have need to do something like this, I have generated a calendar master table with dates and perhaps some bit flags to indicate other generic data about that date (eg, weekends, public holidays, non-working day).

Then I can join (or outer join) my recordset to the calendar master table for reporting purposes.

Regards,

hmscott|||Most times that I have need to do something like this, I have generated a calendar master table with dates and perhaps some bit flags to indicate other generic data about that date (eg, weekends, public holidays, non-working day).

Then I can join (or outer join) my recordset to the calendar master table for reporting purposes.

Regards,

hmscott

Thank you all
I think blindman and htmscott have described pretty much the same method.
I will give these a try and see how it goes.

Cheers
James|||Thanks again guys, the method suggested by you guys works great.

Cheers
Jamessql

Filling in date records

Hi:
This should be pretty simple, but I'm struggling with it. I've got
a table with two columns, Site and dtm_Date. I start with one record
for site that represents the minimum date for that site, and I want to
fill up the table with rows for every date up to the day before the
query is run. So if I start with:
Site dtm_Date
SiteA 11/27/2005 12:00:00AM
SiteB 11/29/2005 12:00:00AM
and I run my SQL Code on Dec 3, 2005, I want to end up with a table
like:
Site dtm_Date
SiteA 11/27/2005 12:00:00AM
SiteA 11/28/2005 12:00:00AM
SiteA 11/29/2005 12:00:00AM
SiteA 11/30/2005 12:00:00AM
SiteA 12/1/2005 12:00:00AM
SiteA 12/2/2005 12:00:00AM
SiteB 11/29/2005 12:00:00AM
SiteB 11/30/2005 12:00:00AM
SiteB 12/1/2005 12:00:00AM
SiteB 12/2/2005 12:00:00AMThe easiest approach is to use a Calendar table. Search the archives of this
newsgroup & you'll find several methods to create one.
Once you have it, you come up with something along the lines of :
SELECT tbl.site, Calendar.dt
FROM Calendar
LEFT OUTER JOIN tbl
ON Calendar.dt BETWEEN tbl.dtm_Date AND CURRENT_TIMESTAMP ;
Anith|||If you plan to insert data into a table, you need to have a source
for the data. In this case, a convenient source is a calendar
table containing all possible SQL Server dates. You can create the
table this way:
create table AllDates (
d datetime primary key
)
go
declare @.mindate datetime set @.mindate = '19000101'
declare @.maxdate datetime set @.maxdate = '21001231'
insert into AllDates values (@.mindate)
while @.@.rowcount > 0 begin
insert into AllDates
select d + tabsize
from AllDates, (
select datediff(day,min(d),max(d))+1 as tabsize from AllDates
) M
where d <= @.maxdate - tabsize
end
go
Once that's done, you can
INSERT INTO yourTable
SELECT yourTable.Site, AllDates.d
FROM yourTable, AllDates
WHERE AllDates.d > yourTable.dtm_Date
AND AllDates.d <= getdate() - 1
[not tested]
This assumes there is exactly one row per Site in your table,
so it will fail if you run it twice, for example.
Steve Kass
Drew University
blairjee@.gmail.com wrote:

> Hi:
> This should be pretty simple, but I'm struggling with it. I've got
> a table with two columns, Site and dtm_Date. I start with one record
> for site that represents the minimum date for that site, and I want to
> fill up the table with rows for every date up to the day before the
> query is run. So if I start with:
> Site dtm_Date
> SiteA 11/27/2005 12:00:00AM
> SiteB 11/29/2005 12:00:00AM
> and I run my SQL Code on Dec 3, 2005, I want to end up with a table
> like:
> Site dtm_Date
> SiteA 11/27/2005 12:00:00AM
> SiteA 11/28/2005 12:00:00AM
> SiteA 11/29/2005 12:00:00AM
> SiteA 11/30/2005 12:00:00AM
> SiteA 12/1/2005 12:00:00AM
> SiteA 12/2/2005 12:00:00AM
> SiteB 11/29/2005 12:00:00AM
> SiteB 11/30/2005 12:00:00AM
> SiteB 12/1/2005 12:00:00AM
> SiteB 12/2/2005 12:00:00AM
>|||I think the Calendar idea is probably a better idea, but you can accomplish
your goals with a cursor:
go
set nocount on
DECLARE @.markdate datetime ,@.site varchar(10)
DECLARE sites_cursor CURSOR
FOR
Select site from sitedate order by site desc
OPEN SITES_cursor
FETCH NEXT FROM SITES_cursor INTO @.site
WHILE @.@.FETCH_STATUS = 0
BEGIN
set @.markdate = (select min(dtm_date) from sitedate)
WHILE @.markdate < getdate()
BEGIN
Insert into sitedate values(@.site,@.markdate)
select @.markdate = dateadd(d,1,@.markdate)
END
FETCH NEXT FROM SITES_cursor into @.site
END
Close SITES_cursor
DEALLOCATE SITES_cursor
<blairjee@.gmail.com> wrote in message
news:1133804570.141750.248940@.g49g2000cwa.googlegroups.com...
> Hi:
> This should be pretty simple, but I'm struggling with it. I've got
> a table with two columns, Site and dtm_Date. I start with one record
> for site that represents the minimum date for that site, and I want to
> fill up the table with rows for every date up to the day before the
> query is run. So if I start with:
> Site dtm_Date
> SiteA 11/27/2005 12:00:00AM
> SiteB 11/29/2005 12:00:00AM
> and I run my SQL Code on Dec 3, 2005, I want to end up with a table
> like:
> Site dtm_Date
> SiteA 11/27/2005 12:00:00AM
> SiteA 11/28/2005 12:00:00AM
> SiteA 11/29/2005 12:00:00AM
> SiteA 11/30/2005 12:00:00AM
> SiteA 12/1/2005 12:00:00AM
> SiteA 12/2/2005 12:00:00AM
> SiteB 11/29/2005 12:00:00AM
> SiteB 11/30/2005 12:00:00AM
> SiteB 12/1/2005 12:00:00AM
> SiteB 12/2/2005 12:00:00AM
>

filling gridview from code

hello, i'd need a little help with filling GridViews

i browsed over like 10 search pages, but couldnt find any which would solve my problem.

so in my ajax project i made a testing page pulled a gridview (GridView1) on it with a fhew buttons and textboxes.
i need to fill the gv from code so my websie.asp.cs looks like this

 
1protected void Page_Load(object sender, EventArgs e)
2 {
3
4
5string connstr ="Data Source=.;database=teszt;user id=user;password=pass";
6 SqlConnection conn =new SqlConnection(connstr);
7 SqlCommand comm =new SqlCommand("select * from users", conn);
8 conn.Open();
9 SqlDataReader reader;
10 reader = comm.ExecuteReader();
11if (reader.HasRows)
12 {
13 GridView1.DataSource = reader;
14 GridView1.DataBind();
15 }
16 reader.Close();
17 conn.Close();
18 comm.Dispose();
19 }

so i load the page and there's no gridview on the page at all, nor an error msg, the connection and the database/table is fine.
any suggestions on what am i doing wrong? and i also like to know if there would be any problem with using this on a tabcontrol/tab
thankyou 


you have bind the data reader.

you have to bind the datasource like datatable or dataset or some list or collection.

That's the problem why you didn't see the grid data.

|||

ahh yes thankyou, i knwer there was smething wrong with that, so i managed the code from msdn, tho the GridView needs to be set to generate cols true

1protected void Page_Load(object sender, EventArgs e)
2 {
3// This example uses Microsoft SQL Server and connects
4 // to the Northwind sample database. The data source needs
5 // to be bound to the GridView control only when the
6 // page is first loaded. Thereafter, the values are
7 // stored in view state.
8if(!IsPostBack)
9 {
10
11// Declare the query string.
12 String queryString =
13"Select * From [users]";
14
15// Run the query and bind the resulting DataSet
16 // to the GridView control.
17 DataSet ds = GetData(queryString);
18if (ds.Tables.Count > 0)
19 {
20 GridView1.DataSource = ds;
21 GridView1.DataBind();
22 }
23else
24 {
25 Response.Write("Unable to connect to the database.");
26 }
27
28 }
29
30 }
31
32 DataSet GetData(String queryString)
33 {
34
35// Retrieve the connection string stored in the Web.config file.
36 String connectionString ="Data Source=.;database=teszt;user id=user;password=pass";
37
38 DataSet ds =new DataSet();
39
40try
41 {
42// Connect to the database and run the query.
43 SqlConnection connection =new SqlConnection(connectionString);
44 SqlDataAdapter adapter =new SqlDataAdapter(queryString, connection);
45
46// Fill the DataSet.
47 adapter.Fill(ds);
48
49 }
50catch(Exception ex)
51 {
52
53// The connection failed. Display an error message.
54 Response.Write("Unable to connect to the database.");
55
56 }
57
58return ds;
|||

one more thing tho, on this page i have a hidden table which contains 2 textboxes and a button, this visibility is also controlled by a button.
so the input fields are for inserting data to the table which the gridview is showing and when i hit the button to execute the insert i want the gridview to be updated so i put a GridView1.DataBind() in my input buttons final things to do, but what happens is after the postback the gridview is gonne. now what is up with that? does it forget its source?

Filling empty characters

Hi,

I am importing barcodes however they are all different lengths and I need to bring them all up to 14 characters by adding zero's to the beginning of them (up to when the field is full).

The only way I can think is doing a count on the char length and then adding zero's in a loop but I think there must be an easier way? Any help appreciated.

Thanks
TimWhat about this?

declare @.line varchar(50),@.len int
set @.line='12345'
set @.len=10
select isnull(replicate('0',@.len-len(@.line)),'')+@.line|||..or the more low-tech:

set @.line = right(14, '00000000000000' + @.line)

blindman|||how low can you go?

Hey, I have to lookup just to see the top of the gutter...

Filling a select box ...

...on an asp page with data from a sql server db. Can anyone give me a thumbnail as to how to do that?
I can collect the field data but I want to fill the select drop-down on page load.
Thanks!!Start an HTML FORM. Build an OPTION item for each row in the recordset. Iterate through the recordset, adding additional OPTION items for each row. Then at .EOF, close the connection and finish off the FORM.|||That was what I needed!sql

Filling a DDL from a SQL DB?

Hello All
I am wanting to fill a drop down list in ASP.NET using C# from a SQL database table using a stored procedure. I have my Sproc. But using ASP.NET C# I have no idea how to do this. Can someone give me a good example, and if not too much trouble, place comments in the code, and give an explanation. I am just learning ASP.NET after moving from Classic. Things are alot different.

Thank You in advnace for all your help

Andrewhttp://aspauthors.com/aspnetbyexample/ch06/

Filling a DataTable from SqlQuery : If SqlQuery returns null values problem ocurrs with Da

Filling a DataTable from SqlQuery : If SqlQuery returns some null values problem ocurrs with DataTable.

Is it possible using DataTable with some null values in it?

Thanks

It's perfectly fine to fill a datatable with some (or all) NULL values... the problem is probably that you are trying to use a field that is not there (because it's null).

Example:

DataTable myDT = new DataTable();

myDataAdapter.Fill(myDT); // <-- there's no problem if there are nulls in there

myDT.Rows[3]["SomeFieldWhichCanBeNull"].ToString(); // <--BANG, there's your error!

|||

You can store the NULL values and to avoid the error, you may check Is it null or not by usingIsNull, like in this example:

1if (!dr.IsNull("MyColumn")2{3 MyColumn = dr["MyColumn"].ToString();4}5

Good luck.

Filling a dataset created from stored procedure

How Do I fill as dateset that i created from a stored procedure in SQL SERVER?
I dragged an stored procedure onto the dataset template from the server explorer.
Do I use the exact same sql statement as in the stored procedure, or can I say something like "SELECT * FROM myStoredProcedure", but that is not working?

Thanks in advanceIf the stored procedure outputs a result set (or more than one), you can set the CommandText of your SqlCommand object to the name of the stored procedure and set the CommandType of your SqlCommand object to CommandType.StoredProcedure.

If your stored procedure does not output a result set, you need to issue the same select statement you have in the stored procedure, but without the variable or temporary table that is accepting the results.

If your stored procedure is returning a table variable, you need to put "select * from @.tablevariablename" at the end of the stored procedure, I think, because I don't think the ASP.NET API will accept a table variable as a stored procedure return value. I could be wrong about that, though.

Monday, March 12, 2012

filegroup full during DBCC

running DBCC CHECKDB repair and wound up filling up the disk - was able
to free up some space, the files are set to grow automatically. The
DBCC is still running - will it eventually bag out, or is it smart
enough to continue now that it has more space?check to see if it is hung by using sp_who2. Watch to see if it consumes cpu
and disk io between consecutive runs of sp_who2. If cpu or io is not
increasing you should kill it.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>|||Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
Estimate_only option to see how much space you may require first.
Andrew J. Kelly SQL MVP
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>|||Andrew J. Kelly wrote:[vbcol=seagreen]
> Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
> Estimate_only option to see how much space you may require first.
> --
> Andrew J. Kelly SQL MVP
> <mdevenney1@.gmail.com> wrote in message
> news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
thanks Hilary and Andrew for the responses - the DBCC did wind up
finishing and performing the repairs needed without any intervention
once I freed up space. Dumb move on my part not running the
Estimate_only first; lesson learned there. And thanks for the tip-off
on sp_who2 - I can see that coming in real handy. I've been admin'ing
SQL Srvr for about 8 years but it's almost a side job, and my db's have
never really run into problems before so now it's time to ratchet up
the diligence a bit. much obliged.

filegroup full during DBCC

running DBCC CHECKDB repair and wound up filling up the disk - was able
to free up some space, the files are set to grow automatically. The
DBCC is still running - will it eventually bag out, or is it smart
enough to continue now that it has more space?check to see if it is hung by using sp_who2. Watch to see if it consumes cpu
and disk io between consecutive runs of sp_who2. If cpu or io is not
increasing you should kill it.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>|||Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
Estimate_only option to see how much space you may require first.
--
Andrew J. Kelly SQL MVP
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>|||Andrew J. Kelly wrote:
> Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
> Estimate_only option to see how much space you may require first.
> --
> Andrew J. Kelly SQL MVP
> <mdevenney1@.gmail.com> wrote in message
> news:1163194366.339470.237560@.h54g2000cwb.googlegroups.com...
> > running DBCC CHECKDB repair and wound up filling up the disk - was able
> > to free up some space, the files are set to grow automatically. The
> > DBCC is still running - will it eventually bag out, or is it smart
> > enough to continue now that it has more space?
> >
thanks Hilary and Andrew for the responses - the DBCC did wind up
finishing and performing the repairs needed without any intervention
once I freed up space. Dumb move on my part not running the
Estimate_only first; lesson learned there. And thanks for the tip-off
on sp_who2 - I can see that coming in real handy. I've been admin'ing
SQL Srvr for about 8 years but it's almost a side job, and my db's have
never really run into problems before so now it's time to ratchet up
the diligence a bit. much obliged.

filegroup full during DBCC

running DBCC CHECKDB repair and wound up filling up the disk - was able
to free up some space, the files are set to grow automatically. The
DBCC is still running - will it eventually bag out, or is it smart
enough to continue now that it has more space?
check to see if it is hung by using sp_who2. Watch to see if it consumes cpu
and disk io between consecutive runs of sp_who2. If cpu or io is not
increasing you should kill it.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegr oups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>
|||Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
Estimate_only option to see how much space you may require first.
Andrew J. Kelly SQL MVP
<mdevenney1@.gmail.com> wrote in message
news:1163194366.339470.237560@.h54g2000cwb.googlegr oups.com...
> running DBCC CHECKDB repair and wound up filling up the disk - was able
> to free up some space, the files are set to grow automatically. The
> DBCC is still running - will it eventually bag out, or is it smart
> enough to continue now that it has more space?
>
|||Andrew J. Kelly wrote:[vbcol=seagreen]
> Was it Tempdb that was full? If so you can run DBCC CHECKDB with the
> Estimate_only option to see how much space you may require first.
> --
> Andrew J. Kelly SQL MVP
> <mdevenney1@.gmail.com> wrote in message
> news:1163194366.339470.237560@.h54g2000cwb.googlegr oups.com...
thanks Hilary and Andrew for the responses - the DBCC did wind up
finishing and performing the repairs needed without any intervention
once I freed up space. Dumb move on my part not running the
Estimate_only first; lesson learned there. And thanks for the tip-off
on sp_who2 - I can see that coming in real handy. I've been admin'ing
SQL Srvr for about 8 years but it's almost a side job, and my db's have
never really run into problems before so now it's time to ratchet up
the diligence a bit. much obliged.