Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Friday, March 30, 2012

How to truncate a log file

I've got a SQL V7 server whose log file has grown out of
control.
Could you please enlighten me to the steps to truncate
this log file
Thank
BillBackup log dbname with truncate_only
If you do not require point in time recovery you might turn on "truncate log
on checkpoint", if you do, schedule regular log backups. See "backup" in BOL
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
--
"bill dunn" <anonymous@.discussions.microsoft.com> wrote in message
news:374C8E81-0C23-4F35-A2B2-2985243A864A@.microsoft.com...
> I've got a SQL V7 server whose log file has grown out of
> control.
> Could you please enlighten me to the steps to truncate
> this log file?
> Thanks
> Bill
>|||Thanks Ray.|||Hi,
In addition to Ray's post , do a DBCC SHRINK file on the transaction log
file.
This will shrink your transaction log file to the minimum size.
For more information on DBCC SHRINKFILE, refer BOL
Thanks
Hari
MCDBA
"bill dunn" <anonymous@.discussions.microsoft.com> wrote in message
news:68488509-6364-446B-B118-4B41FFCFDAFC@.microsoft.com...
> Thanks Ray.|||Hi
You may want to read
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_da2_1uzr.asp
and check previous posts in these newsgroups.
John
"bill dunn" <anonymous@.discussions.microsoft.com> wrote in message
news:374C8E81-0C23-4F35-A2B2-2985243A864A@.microsoft.com...
> I've got a SQL V7 server whose log file has grown out of
> control.
> Could you please enlighten me to the steps to truncate
> this log file?
> Thanks
> Bill
>

Wednesday, March 28, 2012

How to translate DTSStepScriptResult_DontExecuteTask into SSIS?

Hi everyone,

We're struggling ourselves with this and we are stuck.

Which is the equivalent for a SSIS in a Script Task component on CONTROL FLOW layer?

Main = DTSStepScriptResult_ExecuteTask

Thanks for your input and regards,

Set the script result to a variable and then use that variable in a precedence constraint on the Execute XXX Task.|||

To try and expand on Phil's reply. The constant you mention does not exist, because you no longer have workflow scripts as you did in DTS. What you do have is a much richer set of precedence constraint functionality. As well as having the normal succes and failure stype stuff, you can also set an expression on the constraint. The expression uses a new syntax, which is quite simple, but maybe you could replace your script logic with an expression. Your logic may be too complicated for this, so you would have to use an Script Task and from that your result in variable. The variable can easily be referenced in an expressionon the constraint.

I would avoid any ActiveX Script in SSIS, use the new features, including the Script Task if required. The support for ActiveX is not good, things like error information are very poor now.

Monday, March 26, 2012

how to total the values in a numeric column?

I'm building a report using the matrix control. I have financial data in
different line items (Salary, Rental Expense etc) that needs to be shown by
month (so the columns have months). I have it pretty much working but can't
figure out how to sum up the numbers in each column at the bottom so I can
have a total for every month. Could anyone help?
Thanks a lot.
BobRight-click on the row field that you wish to total, in your case it
would be the Salary field. Choose Sub-total from the menu.
To format the subtotals you need to right-click->properties on the tiny
green triangle that appears on the Total cell.|||ahhh. I was thinking this must be something really simple since it's such a
common function. You can't believe how much time I had spent trying to
figure this out. Thanks a lot.
Bob
"grahamiec" <grahamrichter@.gmail.com> wrote in message
news:1123769689.664448.10490@.g14g2000cwa.googlegroups.com...
> Right-click on the row field that you wish to total, in your case it
> would be the Salary field. Choose Sub-total from the menu.
> To format the subtotals you need to right-click->properties on the tiny
> green triangle that appears on the Total cell.
>

How to tie together all tabs

Once I have stuff completed in each of the tabs (Control Flow, Data Flow, Event Handlers, etc..) how to I tie them all together in sequence so that each runs?

Each part will run when it is time for it. There is no explicit step to tie them together, but you do need to understand what each part is for.

The control flow is the root, which represents the high level view of the package. Each data flow task is already represented in the control flow as Data Flow task. The Data Flow tab just shows the inside of this task.

Similarly each event handler is bound to a task in main control flow or another event handler and an event (potentially) raised by this task. The event handlers are run when the corresponding task fires the corresponding event.

|||Ok, figured it out. I simply split my logic up into 2 data flow tasks on the control flow and ran a execute sql task in between...all of it is managed on the control flow tab...this is great!

Wednesday, March 7, 2012

How to store the results of a query in a variable.

Can anyone tell me or point me in the direction of how I can store select query results to a variable in VB.NET? Im using the SqlDataSource control with dropdowns and textboxes for searching. I want to store the search results in a variable on the button click event.

Dim dv As DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
Dim dr As DataRow
dr = dv.Table.Rows(0)

session("variable1") = dr("ColumnName1").ToString()
Dim strVar2 as string = dr("ColumnName2").ToString()

etc.

|||

Depending on what you are trying to store, there are several options. First, gather the data in a single variable. This can be a collection, array, some user-defined object or even a dataset.

Once you have the variable, you may do several things with it:

Session - If the resultsets will be different for each user, you may want to use session. Session variables exist for a certain amount of time, then disappear when that time expires. If the session expires, the variable will become NULL (Nothing in VB.NET).

eg: Session["DataSet"] = dataSet;

Cache - If the resultsets will be the same for each user, you may want to use cache. The Page.Cache object can store data for as long as you need it, only refreshing the data after an amount of time has elapsed or if an event triggers the cache to be emptied.

eg: Page.Cache.Add("DataSet", dataSet, cacheDependency,DateTime.Now.AddHours(5));

ViewState - If the resultsets will not be used for long, but need to be used across a postback, you may want to use viewstate. Viewstate is used to maintain state at the page level. That being said, it does not exist on another page, but does exist when you postback to the same page. Use this if you only need the data for a limited amount of time, but you plan on spending awhile on the same page.

eg: ViewState.Add("DataSet", dataSet);

Hope this helps.

Friday, February 24, 2012

How to store a content into database

Hi everyone,

I'm just using TEXTBOX control to save data into my DB. My question is, if I have multiple lines of sentences, it does not store as what it looks like. For example;

Hello,
Mike

It stores into the database as "Hello, Mike" and if I read from the database, it does not have seperate lines and shows it like this;


Hello, Mike

How can I store the contents into database and make the contents as original?
(Sorry for the poor English, but I hope you understand it.)

One way of doing this will be to replace all new lines with <BR> before saving it to database.

do something like that:

TextBox1.Text.Replace(vbCrLf,

"<br>")|||

SQL Server dose accept carriage returns, but note it stores carriage returns as 2 characters:1st for line feed (ascii code 10)and 2nd for carriage return (ascii code 13). How did you push the lines in the textbox into database? If you use a single string which contains multiple lines, then you can get the lines back from database. For example:

using (SqlConnection conn = new SqlConnection(@."Data Source=.\iori2000;Integrated Security=SSPI;Database=tempdb"))
{
conn.Open();
SqlCommand cmd = new SqlCommand("CustOrderHist", conn);
string s1 = textBox1.Text;

cmd.CommandText = "INSERT INTO testString SELECT @.v";
cmd.Parameters.Add("@.v", SqlDbType.VarChar).Value = s1;

cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT s FROM testString";
SqlDataReader sda = cmd.ExecuteReader();
sda.Read();
s1 = sda.GetString(0);
textBox1.Text = "Retrieved:\n" + s1;
}

Sunday, February 19, 2012

How to stop PAD_INDEX being scripted

Our team checks SQL scripts into version control. On my machine, however, the generated script always differs slightly. When I generate a create table script, the primary key part always has PAD_INDEX = OFF. Nobody else's server generates this. Does anyone know what option or setting I need to change to prevent PAD_INDEX = OFF from being output?

WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]

BOL specifies

When creating indexed views or manipulating rows in tables participating in an indexed view, seven SET options must be assigned specific values. The SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be ON. The SET option NUMERIC_ROUNDABORT must be OFF.

If any of these settings is different, data modification statements (INSERT, UPDATE, DELETE) on any table referenced by an indexed view fail and SQL Server raises an error listing all SET options that violate setting requirements. In addition, for a SELECT statement that involves an indexed view, if the values of any of the SET options are not the required values, SQL Server processes the SELECT without considering the indexed view substitution. This ensures correctness of query result in cases where it can be affected by the above SET options.

If the application uses a DB-Library connection, all seven SET options on the server must be assigned the required values. (By default, OLE DB and ODBC connections have set all of the required SET options correctly, except for ARITHABORT.)

|||

Thank you for taking the time to copy and paste. However, I don't see how your post is relevant.

I am asking what determines whether the PAD_INDEX option is included in scripted CREATE TABLE statements.

|||Is anyone able to help with this?