Get Last Record, Of Many... Read To Understand

Mar 13, 2008

Ok,

I have a table with the following fields:

ID, Type, Name, Date, Description

ID is the PK. Names all have different values, but are predefined... a visual:

ID, Type, Name, Date, Description

1, monday, mon1234,3-3-08, some text

2, monday, mon1234,3-4-08, some text

3, monday, mon2345, 3-5-08, some text

4, monday, mon2345, 3-6-08, some text

 Now What i need to do is get the last report for each unique "Name". How would I do that?

When I try to do a Select Distinct, of course, it only gives me those names that only appear once.

View 3 Replies


ADVERTISEMENT

How To Remember Last Record Read

Jul 23, 2005

Hi,Can you guys see if there's a solution to this problem?I have a database from which I have to read each record and processthat record. New records are being added all the time, so I need to goback and check for new records and process them.However:-- there is no 'identity' column in the database design (so I cannotkeep track of the last record read by use of a numeric variable)-- I am not allowed to update the database (so I cannot flag therecords I have read).My problem is: how can I know which records I have already read andwhich ones I haven't read yet? I don't want to process records twiceand don't want to miss any records.Is there a known solution to this problem? Any ideas?Thanks.

View 12 Replies View Related

Make A Database Record Read Only?

Oct 22, 2007



Hi.

I have a table where I need to set some rows to Read only (to protect the rows from being edited). Can I do this with a trigger checking against a column (where dataReadOnly = 1)?

Or is there a better way?

thankyou

View 6 Replies View Related

How To Use For Each Loop To Read One Record And Insert The Same Into Destination

Jul 27, 2007

Hi,

My procedure to implement a task is like this

I will be using execute SQL task to fetch the records from source,after this wanna use For each loop to access each record one at a time,perform some trnsformations and insert that record into destination.

Help me in accessing the data stored in the Variable(SQL task) in Dataflow task of foreach loop.

View 10 Replies View Related

Reg: How To Read Record One By One From File Source In SSIS

Apr 18, 2008

Hello,

Is there any way to implement sequence data read.

Note:
source is .csv or flat file file
i want process the records one by one.

please give me the solution ASAP.

Thanks
Thiru

View 4 Replies View Related

Transact SQL :: Making Server Database Read / Write From Read Only

Jan 12, 2012

i attached adventure works in sql server 2008 and it showing as read only ,make it read write or remove read only tag from database.

View 11 Replies View Related

Hm...can`t Understand, Please Help

Dec 27, 2004

i have this situations:

the aspx file with source code work good.
when i try run project which created from VS i take
"SQL Server does not exist or access denied."
connection strings same:

"Data Source=**.**.**.**,1433;Network Library=DBMSSOCN;Initial Catalog=slider;User ID=username;Password=password;"

i think may be it`s web.config in project wrong?

Edited by SomeNewKid
Removed username and password from connection string.

View 1 Replies View Related

Don't Understand

Aug 27, 2006

I am having a problem reinstall SQL Express 2005.  I had it installed, but then I unistalled it.  I have tried installing it again, but everytime I do it says that the product is already installed.  There is no instance of it in my Add/Remove Programs.  I have read the threads that relate to this topic, but they haven't helped.  I have looked at my logs of the installs, but they don't make sense neither.  I just want the program installed again, or a way to get it so that I can use it. 

When I try to manually uninstall using msiexec.exe /x <processid> I get an error saying that the package could not be opened.  This happens with all the process ids I use that I get from the log files (I have 11 logs).

 am using Visual Basic 2005 and trying to create a database, and it will not let me.  That is how I know that it is not installed, plus I can't find any instance of it one my computer.  Please help.  Thanks.

View 8 Replies View Related

I Need To Understand

Nov 19, 2006

How di I understand what SQL Server Integration Services mean? Can some one help me?

View 3 Replies View Related

SQL 2012 :: Identify Whether Files Are In Read / Write Or Read Only

Mar 24, 2015

How to identify whether the files are in read write or read only?

View 1 Replies View Related

Recovery :: Switch (Standby / Read-Only) DB To Be Read And Write

Aug 26, 2015

I'm trying to do Sharepoint DR with Log Shipping and every thing configured except one thing which is switch the WSS_Content (Standby /Read-Only) DB to be ready and Write. 

I tried from

GUI or ALTER DATABASE [WSS_Content] SET
READ_WRITE WITH NO_WAIT

but I received the below error: 

Database WSS_Content is in Warm Standby 

View 9 Replies View Related

Reset Database Files From Read-only To Read-write

Jan 18, 2008

I have two database files, one .mdf and one .ndf. The creator of these files has marked them readonly. I want to "attach" these files to a new database, but cannot do so because they are read-only. I get this message:

Server: Msg 3415, Level 16, State 2, Line 1
Database 'TestSprintLD2' is read-only or has read-only files and must be made writable before it can be upgraded.

What command(s) are needed to make these files read_write?

thanks

View 7 Replies View Related

Isn't Working... I Don't Understand?

Feb 23, 2008

I'm trying to put together a very simple page where you can click the up and down button to move the item up or down in the list and save the new list into the database. I've run the stored procedure... and it works so Its not a procedure problem. Here is the list in my databaseOrder_Id        Item         Position1                  Sebring     12                  GrandPrix  23                  Accord      44                  Miati         3 When I go to click the button I get a object reference not set to an instance of an object... This error haunts me many times. Heres the code to my project:BLL  /// <summary>
/// Gets Items from the Item table.
/// </summary>
/// <returns>A list of items.</returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public OrderItemDataSet.OrderItemDataTable GetItemDataByPosition()
{
return OrderItemAdapter.GetItemDataByPosition();
}

/// <summary>
/// Gets the order id based on the position specified.
/// </summary>
/// <returns>The order id.</returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public int SelectOrderIdByPos(int pos)
{
return SelectOrderIdByPos(pos);
}

/// <summary>
/// Update Order list.
/// </summary>
/// <param name="newPos">Position to change to.</param>
/// <param name="originalPos">Original position.</param>
/// <param name="orderId">Original id.</param>
/// <param name="otherOrderId">Position to change id.</param>
/// <returns></returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
public void ReorderItemByIdAndPosition(int newPos, int originalPos, int orderId, int otherOrderId)
{
OrderItemAdapter.ReorderItemByIdAndPosition(newPos, originalPos, orderId, otherOrderId);
}   Codebehind  1 using ReorderListWebApplication.BLL;
2 using System;
3 using System.Collections;
4 using System.Configuration;
5 using System.Data;
6 using System.Linq;
7 using System.Web;
8 using System.Web.Security;
9 using System.Web.UI;
10 using System.Web.UI.HtmlControls;
11 using System.Web.UI.WebControls;
12 using System.Web.UI.WebControls.WebParts;
13 using System.Xml.Linq;
14
15 namespace ReorderListWebApplication
16 {
17 public partial class _Default : System.Web.UI.Page
18 {
19 protected void Page_Load(object sender, EventArgs e)
20 {
21
22 }
23
24 protected void UpButton_OnClick(object sender, EventArgs e)
25 {
26 Label posLabel = (Label)ReorderItemDataList.FindControl("PosLabel");
27 Label idLabel = (Label)ReorderItemDataList.FindControl("IdLabel");
28
29 using (ReorderListWebApplication.BLL.OrderItem item = new ReorderListWebApplication.BLL.OrderItem())
30 {
31 int pos = 0;
32
33 pos = item.SelectOrderIdByPos(Convert.ToInt32(idLabel.Text) - 1);
34
35 // Grab other orderId!!
36 item.ReorderItemByIdAndPosition((Convert.ToInt32(posLabel.Text) - 1), Convert.ToInt32(posLabel.Text), 3, pos);
37 }
38 }
39
40 protected void DownButton_OnClick(object sender, EventArgs e)
41 {
42 using (ReorderListWebApplication.BLL.OrderItem item = new ReorderListWebApplication.BLL.OrderItem())
43 {
44
45 }
46 }
47 }
48 }
49
 

View 8 Replies View Related

I Don't Understand The Following Error....

May 2, 2008

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: You have specified that your update command compares all values on SqlDataSource 'SqlDataSource5', but the dictionary passed in for oldValues is empty.  Pass in a valid dictionary for update or change your mode to OverwriteChanges.
can somebody tell me what this is?
Angiemarie

View 3 Replies View Related

Don't Understand This Error

Oct 18, 2005

Hello, I could use some help with this error message:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
This if statement is the problem
IF (select bill_freq from #header1) = '1'   update #header1 Set     [Monthend] =  aa.pername    from sv00564 zz inner join sv00532 aa on zz.wennsoft_period_id = aa.wennsoft_period_id   Where zz.rmdnumwk like #header1.Invoice_Number

View 1 Replies View Related

Don't Understand Error...

May 4, 2006

This is failing:// Trying to update DynamicPageContent.Html where DynamicPageContent.PageID='121'//With// Select Html from DynamicPageHistory where HistoryID='831'//Update DynamicPageContentSET Html=(SELECT Html FROM DynamicPageHistory WHERE HistoryID='831')WHERE PageID='121'With the following error:Server: Msg 279, Level 16, State 3, Line 1The text, ntext, and image data types are invalid in this subquery or aggregate expression.DynamicPageContent.Html is Ntext size 16 and DynamicPageHistory.Html is Ntext size 16. PageID is and int and HistoryID is an int. It fails with single quotes around 831 and 121 and it fails without single quotes. The error message is the same both ways.Ideas?Thanks,Rex

View 4 Replies View Related

Starting To Understand

Jun 29, 2004

I feel extremly happy today and let me share with this wonderful forum why.

SQL is awesome and I'm really learning that theres alot of resources out there and coding is not that hard once you understand what your doing. Just took awhile for things to sink in. I still have a long ways to go but I'm really enjoying using sql. I practically live in our SQL Server 2000 at work and I'm learning more and more about it everyday.

Thank YOu so much guys I really appreciate all the help you've given me
Now I'm gonna study for the sql cert

:)

View 3 Replies View Related

Don't Understand GROUP BY...

Mar 8, 2005

I have a table Test_GUID, with fields id as int PK IDENTITY, GUID as varchar(50), and Version as tinyint. I put data in it such as

id GUID Version
------------------
1 abc 1
2 abc 2
3 def 1


Then I tried to get the following result:

id GUID Version
-------------------
1 abc 2
3 def 1

By using a query:

SELECT GUID, MAX(Version) AS MaxVersion, id
FROM dbo.Test_GUID
GROUP BY GUID

But then I get an error because id is not being aggregated.

This works

SELECT GUID, MAX(Version) AS MaxVersion
FROM dbo.Test_GUID
GROUP BY GUID

but then how do I get the id of each record?

View 2 Replies View Related

Help Me To Understand This SQL Sentence

Jul 18, 2006

Set @mSQL = 'SELECT Max([AccountID] + [ItemID] + [StorehouseID] + [BINID] + [LotItemID] + Convert(varchar(10),[BalDate],111)) AS [KEY],
AccountID, ItemID, StorehouseID, BINID, LotItemID INTO [xIV_tblStockSumLastDate' + ']
FROM IV_tblIVMaster
WHERE (BalDate<= 'Exec(@mSQL + '''' + @mtxtDate + '''' + ')
GROUP BY ItemID, AccountID, StorehouseID, BINID, LotItemID')

View 13 Replies View Related

Don't Understand The Error.

Oct 18, 2006

I'm doing code with VB.Net.

The error was:
System.FormatException: Input string was not in a correct format.


The line this is happening on is:
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")


I don't understand, it is giving that error particularly when I want to get ClientRepID

Some more lines from the code:
Response.Write("<TD><p>" + rdData("Username") + "</p></TD>")
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")

The first line the compiler had no problem but when it gets to the second line with ClientRepID it gives me this error. (ClientRepID exists in the database)

Can someone please help me? Thanks

View 4 Replies View Related

I Don't Understand Licencing

Apr 19, 2007

Hello, i just bought sql server 2005 with 5 cals (previously i was using a shared sql server with my previous host)... I probably should have asked this question before i bought it... i don't understand how the cal licencing works... the sql server is for running our ecommerce site, i just got a dedicated server to put this on... but from reading the licencing does this mean that only 5 internet users can access my website(or the information in the database) at a time???

any help with this would be appreciated

~ Moe

View 4 Replies View Related

I Don't Understand Quoted_identifier

Mar 24, 2008

OK, so I know that following works if I want update/insert the value "joe's bar" into the table.


set SET QUOTED_IDENTIFIER on
update #temp set id=4 where name ='joe''s bar'


The thing is, I do not conceptually understand what is happening and it is driving me nuts. I have read and re-read the description of quoted_identifier in books online and I still don't get it. How does the extra ' after joe make it work? Is there any hope for me? :)

View 4 Replies View Related

Trying To Understand Triggers

Jul 23, 2005

Hi,Newbie here. I have a mailing list program that I really like. I also have anew membership program. The membership program has mailing list signupsbuilt-in, but it isn't nearly as robust as the stand-alone mail program.If someone signs up for a newsletter when they register (membershipprogram), can a "trigger" in SQL Server put the same information into thestand-alone program's tables? And when they remove or update theirlists/info? And vice-versa?Is this what a "trigger" would do? And is it efficient?Thanks,JA

View 2 Replies View Related

SQL Backup - Dun Understand

Nov 23, 2005

Hi ,I am running SQL server 2000 sp3a and i have set up my database to be in"Full Recovery" mode.I am not able to understand if i have set anything wrong here :1. Full database Backup - every weekend2. Differential Backup - twice a day3. Txn log backup - 4 times a day (4hrs apart)Situation :my Txn Log file is now 18GB ,i can see it's only taking up around 1.5 GB ofactual space usedQues :i thought after every full database backup on each weekend, the txn logbackup will clear up the txn log , if so i see no reason why the txn log cangrow to 18 GB unless between the txn log backup , there's alot of data comingin that caused the txn log to grow but this is not the casekindly advise if my setup is wrong or what could have happened somwhere tocause the log to grow so muchtks & rdgs--Message posted via SQLMonster.comhttp://www.sqlmonster.com/Uwe/Forum...eneral/200511/1

View 2 Replies View Related

Primary Key: I Am Trying To Understand--please Help If You Can.

Jul 20, 2005

Hi all,So I've been reading the newsgroups, and reading a few books trying to learnSQL and SQL Server 2000. The books tell me I need a Primary Key, and thatevery table should have one. I know (I think) that a Primary Key is aspecial field that uniquely identifies each record or row within a table.My question is this: If I have a field or column whose values are all (andwill be) different in every row, is that what a Primary Key is, or is it nota primary key until I designate it as such with either a statement or byright-clicking a little key on the table diagram.If so, then what is the reason _behind_ why I have to do that, and have aprimary key?I've been playing with a few tables, and I can select information just fine,relate tables together with joins, and everything works fine (so far) allwithout my designating any Primary Keys--so why, exactly, do I need one, andexactly what is it?I would appreciate any help and clarification.Thanks.

View 4 Replies View Related

I Don´t Understand

Jun 23, 2006

i´m sorry my bad english

i have a dts in sql server 2005

for example in sql server 2000 i can do that :

over DTS right-clik choose option "Scheduled pachage" and this create a scheduled what i mean is that this produces a "JOB"

what i mean is that i need to know how can to create a scheduled to DTS´s in sql 2005

Please anyone of you provide some solution for this.

View 13 Replies View Related

Help With An Error I Don't Understand

Aug 31, 2007

Hey everyone,

I'm trying to make an image appear differently depending on the values of certain data. The statement that I am using is:

= IIF(DATEDIFF("dd",Fields!LastBackupDate.Value,Now)>15,"redball",IIF(DATEDIFF("dd",Fields!LastBackupDate.Value,Now)<8,"greenball","yellowball"))

And the error that I get is:


[rsRuntimeErrorInExpression] The Value expression for the image €˜image4€™ contains an error: Argument 'Interval' is not a valid value.

Preview complete -- 0 errors, 1 warnings

When I preview the report I just get the typical white box with a red x where the image should be. I don't understand.

Thanks in advance,
Keith

View 1 Replies View Related

Read Text File From SQL Server, Read Its Content, And Load It In RichTextBox (Related Component: Context.Response.BinaryWrite(), And StreamReader)

Nov 26, 2007

OBJECTIVE: I would like to read a text file from SQL Server 2000, read the text file content, and load its conntents in a RichTextBoxTHINGS I'VE DONE AND HAVE WORKING:1) I've successfully load a text file (ex: textFile.txt) in sql server database table column (with datatype Image) 2) I've also able to load the file using a Handler as below: using System;using System.Web;using System.Data.SqlClient;public class HandlerImage : IHttpHandler {string connectionString;public void ProcessRequest (HttpContext context) {connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["NWS_ScheduleSQL2000"].ConnectionString;int ImageID = Convert.ToInt32(context.Request.QueryString["id"]);SqlConnection myConnection = new SqlConnection(connectionString);string Command = "SELECT [Image], Image_Type FROM Images WHERE Image_Id=@Image_Id";SqlCommand cmd = new SqlCommand(Command, myConnection);cmd.Parameters.Add("@Image_Id", System.Data.SqlDbType.Int).Value = ImageID;SqlDataReader dr;myConnection.Open(); cmd.Prepare(); dr = cmd.ExecuteReader();if (dr.Read()){ //WRITE IMAGE TO THE BROWSERcontext.Response.ContentType = dr["Image_Type"].ToString();context.Response.BinaryWrite((byte[])dr["Image"]);}myConnection.Close();}public bool IsReusable {get {return false;}}}'>'>
<a href='<%# "HandlerDocument.ashx?id=" + Eval("Doc_ID") %>'>File
</a>- Click on this link, I'll be able to download or view the file WHAT I WANT TO DO, BUT HAVE PROBLEM:- I would like to be able to read CONTENT of this file and load it in a string as belowStreamReader SR = new StreamReader()SR = File.Open("File.txt");String contentText = SR.Readline();txtBox.text = contentText;BUT THIS ONLY WORK FOR files in the server.I would like to be able to read FILE CONTENTS from SQL Server.PLEASE HELP. I really appreciate it.

View 1 Replies View Related

Simple Query Which I Am Not Able To Understand

Jun 13, 2008

 Hi,I have a float column in the database. When ever, I enter a value into the table, the values are rounded. Suppose I execute the following script: create table tblamount(    flttotal_amount    float)insert into tblamount values (0.00)insert into tblamount values (0.00)insert into tblamount values (0.00)insert into tblamount values (0.00)select * from #tblamount returns the following values:0000 but I want the ouput with the values 0.00 that I entered in the DB. Can u pls help me out with this? 

View 2 Replies View Related

Unable To Understand The YTD MDX Function

Dec 5, 2004

Hi,

Me and my thick skull :)

Couldn't get much help from books on-line and therefore can someone please helpme understand

the YTD function withan example maybe?

View 3 Replies View Related

Unable To Understand The Script ???

Apr 4, 2008

Hi,
i have a stored procedure as :
----------------------------------------------------------
CREATE PROCEDURE Insert_tblAccount
@Name varchar(50),
@Password varchar(20),
@StatusID int,
@AccountType int,
@DOI datetime,
@ROI varchar(500)
AS

Declare @NewID Numeric(18)

BEGIN

SET NOCOUNT ON

INSERT INTO [tblAccount](Name, [Password], StatusID,AccountType, DOI, ROI )
VALUES(@Name, @Password, @StatusID, @AccountType, @DOI, @ROI)

Set @NewID = SCOPE_IDENTITY()
Select @NewID As NewID
END
----------------------------------------------------------------

i could not understand the line
Select @NewID As NewID
bcoz i have learned that NewId() function returns unique identifier
but above code returns same value as SCOPE_IDENTITY.

So can anybody make me clear what's going on ?????

thanx in advance

San

View 2 Replies View Related

Don't Understand The Following Locking Behavior

Jul 23, 2005

can't figure out why the following locking scenario works the way itdoes:spid 1:start transactionselect a row from table T1 with updlockresult: see an Update lock for the row and index keyspid 2:query for the same row as in session 1result: the query succeedsspid 3:do same as spid 1result: blocks trying to get Update lock on the index key for rowNow I do the query again in spid 2 and it blocks trying to get a Sharedlock on the index key, and it's waiting for spid3. why was it able toget a shared lock on a index key that had an Update lock at first butthen can't get the same shared lock when somebody else is also tryingto get an update lock?

View 7 Replies View Related

I Don't Understand This Server Timeout

Feb 2, 2007

I was doing update statements in SQL Server 2000.I have a table with over 16 million rows.It came from several hundred delimited text files,and two of the columns are file ID (int) and Line # (int)Structure is X12 (835). For those unfamiliar with that,each file has one to many BPR lines; each BPR line haszero to many CLP lines, each of those has zero to manySVC lines, each of those has zero to many CAS lines.Working with this through the Enterprise Manager MMC,a lot of things I tried got timeouts.So, I indexed File ID, Line number, and line type, andcreated a new table containing only the columns I knewI would need in the final output--selected fields fromsome of the line types mentioned, plus the line numbersand common file ID for those rows.I indexed every column in that table that I thought I mightsearch on.I loaded it with 31 thousand rows using a select on asubset of the CAS rows. That took far less than a minute.I updated each row with the highest BPR line number not higherthan the CASE line number. About a minute. Not bad, with havingthe worst case number of comparisons being 16 million times 31 thousand.Of course, the indexing should help plus it can be narrowed down bythe "same file" and BPR # < CAS # criteria.But the next update should theoretically be faster: each row now hasa BPR # and a CAS # and I am telling it to find the highest CLP numberBETWEEN those two. So it should have a MUCH smaller set of to searchthrough. Yet it thinks for about five minutes and then announces a timeout.Any suggestions?--Wes GroleauMeasure with a micrometer, mark with chalk, and cut with an axe.

View 20 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved