New Rows From Database
May 30, 2006
Hi,
I am new to SQL and I need help with following query.
I need to retrieve newly added columns from a table. Records will be added to this table on a daily basis and I need to retrieve the records added the previous day.
Can anyone help me with it.
Thanks
View 5 Replies
ADVERTISEMENT
Jun 4, 2007
Stepping thru the code with the debugger shows the dataset rows being deleted.
After executing the code, and getting to the page presentation. Then I stop the debug and start the
page creation process again ( Page_Load ). The database still has the original deleted dataset rows.
Adding rows works, then updating works fine, but deleting rows, does not seem to work.
The dataset is configured to send the DataSet updates to the database. Use the standard wizard to create the dataSet.
cDependChildTA.Fill(cDependChildDs._ClientDependentChild, UserId); rowCountDb = cDependChildDs._ClientDependentChild.Count; for (row = 0; row < rowCountDb; row++) { dr_dependentChild = cDependChildDs._ClientDependentChild.Rows[0]; dr_dependentChild.Delete(); //cDependChildDs._ClientDependentChild.Rows.RemoveAt(0); //cDependChildDs._ClientDependentChild.Rows.Remove(0); /* update the Client Process Table Adapter*/ // cDependChildTA.Update(cDependChildDs._ClientDependentChild); // cDependChildTA.Update(cDependChildDs._ClientDependentChild); }
/* zero rows in the DataSet at this point */ /* update the Child Table Adapter */ cDependChildTA.Update(cDependChildDs._ClientDependentChild);
View 1 Replies
View Related
Feb 5, 2008
Hi!Can anybody help me please? I don't know what is wrong with the underline row... Dim UtilizadorID As String = HttpContext.Current.User.Identity.Name.ToString Dim ProducaoSource As New SqlDataSource() ProducaoSource.ConnectionString = ConfigurationManager.ConnectionStrings("seaempiresdbConnectionString1").ToString() ProducaoSource.SelectCommandType = SqlDataSourceCommandType.Text ProducaoSource.SelectCommand = "SELECT * FROM Producao WHERE ProdUserID = UtilizadorID" TotalLinhas = ProducaoSource.Rows.Count() If TotalLinhas = 0 Then
What I want is to determine if the user is already in a particular DataBase.Thanks in advance.
View 7 Replies
View Related
Jan 14, 2008
This is a question that I have not had an opportunity to test. Was wanting to know if anyone in the SQl world knows the answer. In SQL 2K and 2005 your rolls are limited to 8060 bytes without using varchar(MAX). My question is do you have to specify varchar(max) before your roll can exceed 8060 or does SQL 2005 exceed without specifing varchar(Max). Also does it expand it across multiple pages automatically. Please assist if you can.
Thanks
View 2 Replies
View Related
Jan 7, 2007
I keep getting this error but it will only insert the 1st row into my database table
The variable name '@CustId' has already been declared. Variable names must be unique within a query batch or stored procedure.
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim drow As GridViewRow
For Each drow In GridView1.Rows
Dim textBoxText As String = CType(drow.FindControl("Label2"), Label).Text
SqlDataSource2.InsertParameters.Add("CustId", TypeCode.String, Profile.UserName)
SqlDataSource2.InsertParameters.Add("OrderDate", TypeCode.DateTime, DateTime.Now.ToString)
SqlDataSource2.InsertParameters.Add("Total", TypeCode.Double, TotalUnitPrice)
SqlDataSource2.InsertParameters.Add("Quantity", TypeCode.Int32, textBoxText)
SqlDataSource2.Insert()
Next
Response.Redirect("checkout.aspx")
End Sub
View 3 Replies
View Related
Jan 10, 2008
I am setting up a database which schedules production and tracks inventory of items on a daily basis. The scheduler may put in 100 identical entries (apart from the identity column) of an item with its corresponding quantity. My problem is, if there is a shipment of product (a subtraction of quantity from the database), how can I delete a specified number of rows where the inventory listing is 100,000 pcs? I think the DELETE TOP(r) command will work but I don't know how make the command into an actual variable. Maybe there is another way too...
My current not-working try; I look at the product desired to delete, figure out how many rows to delete, and since it is not always an integer, figure out a quantity to add back in. The addition part works fine but delete command needs work. Any help is appreciated.
int InvRows = 0; decimal RealInvRows = 0; decimal AddQty = 0; int preAddAmount = 0; protected void DelInv_Click(object sender, EventArgs e) { Label TotProdSum = (Label)DetailsView2.FindControl("TotProdSum"); Label RowQty = (Label)DetailsView3.FindControl("RowQty"); int SubQty = Convert.ToInt32(ShipQty.Text); InvRows = SubQty / Convert.ToInt32(RowQty.Text) + 1; RealInvRows = SubQty / Convert.ToDecimal(RowQty.Text); AddQty = (InvRows - RealInvRows) * Convert.ToInt32(RowQty.Text); IntLbl.Text = Convert.ToString(InvRows); RealLbl.Text = Convert.ToString(RealInvRows); preAddAmount = Convert.ToInt32(AddQty); AddAmount.Text = Convert.ToString(preAddAmount); for (int r = 0; r <= InvRows; r++) { forWhile.DeleteCommand = "DELETE TOP (r) FROM Inventory WHERE (Inventory = @Inventory)"; forWhile.DeleteParameters.Add("Inventory", RowQty.Text); forWhile.Delete(); forWhile.DeleteParameters.Clear(); } forWhile.InsertCommand = "INSERT INTO Inventory(Dte, Product, Inventory) VALUES (@Dte, @Product, @Inventory)"; forWhile.InsertParameters.Add("Inventory", AddAmount.Text); forWhile.InsertParameters.Add("Product", InvProdDDL.Text); forWhile.InsertParameters.Add("Dte", Date.Text); forWhile.Insert(); forWhile.InsertParameters.Clear(); }
View 1 Replies
View Related
Jan 23, 2008
Hi
Iam developing online test using ASP.NET,C#.NET.Now my doubt is test takers should get random questions from the database sqlserver2005.Already i ve inserted 10 question into the database.I ve used NEW ID() .But questions are repeating.I am new commer in to IT industry .Provide me with code.Given below is my code.I can retrive questions from the database now but cannot get in random order.protected void Page_Load(object sender, EventArgs e)
{Label10.Visible = false;
Label9.Visible = false;if (!IsPostBack)
{if (Session["id"] == null)
{Session["id"] = 1;
}Session["ans"] = 0;SqlConnection con = new SqlConnection(@"server=123-9181FF31362SQLEXPRESS;user id=sampleu;pwd=Sampleu2;database=n;");
con.Open();
SqlCommand cmd = new SqlCommand("select * from n3 where sno='" + Convert.ToInt16(Session["id"].ToString()) + "' ", con);SqlDataReader re;
re = cmd.ExecuteReader();while (re.Read())
{
Label1.Text = re[0].ToString();
Label2.Text = re[1].ToString();
Label3.Text = re[2].ToString();
Label4.Text = re[3].ToString();
Label5.Text = re[4].ToString();
Label6.Text = re[5].ToString();string sss = re[6].ToString();if (sss == "nil")
{
Panel1.Visible = true;Panel2.Visible = false;
}
else
{Panel1.Visible = false;Panel2.Visible = true;
}
}
re.Close();
}
}
protected void Button1_Click(object sender, EventArgs e)
{string Answer = "";if (RadioButton1.Checked == true)
{Answer = "A";
}else if (RadioButton2.Checked == true)
{Answer = "B";
}else if (RadioButton3.Checked == true)
{Answer = "C";
}else if (RadioButton4.Checked == true)
{Answer = "D";
}else if (RadioButton5.Checked == true)
{Answer = "True";
}else if (RadioButton6.Checked == true)
{Answer = "False";
}SqlConnection con1 = new SqlConnection(@"server=123-9181FF31362SQLEXPRESS;user id=sampleu;pwd=Sampleu2;database=n;");
con1.Open();
string ss = Session["id"].ToString();SqlCommand cmd1 = new SqlCommand("select Answer from n3 where sno='" + Convert.ToInt16(Session["id"].ToString()) + "' ", con1);
SqlDataReader re1;string result1 = "";
re1 = cmd1.ExecuteReader();if (re1.Read())
{
result1 = re1[0].ToString();
}
//Session["ans"] = 0;if (Answer == result1)
{Session["ans"] = (Convert.ToInt16(Session["ans"].ToString()) + 1);
}
con1.Close();
Session["id"] = (Convert.ToInt16(Session["id"]) + 1);
RadioButton1.Checked = false;RadioButton2.Checked = false;
RadioButton3.Checked = false;RadioButton4.Checked = false;
RadioButton5.Checked = false;RadioButton6.Checked = false;
SqlConnection con = new SqlConnection(@"server=123-9181FF31362SQLEXPRESS;user id=sampleu;pwd=Sampleu2;database=n;");
con.Open();SqlCommand cmd = new SqlCommand("select * from n3 where sno='" + Convert.ToInt16(Session["id"].ToString()) + "' ", con);SqlDataReader re;
re = cmd.ExecuteReader();
while (re.Read())
{
Label1.Text = re[0].ToString();
Label2.Text = re[1].ToString();
Label3.Text = re[2].ToString();
Label4.Text = re[3].ToString();
Label5.Text = re[4].ToString();
Label6.Text = re[5].ToString();string sss = re[6].ToString();if (sss == "nil")
{
Panel1.Visible = true;Panel2.Visible = false;
}
else
{Panel1.Visible = false;Panel2.Visible = true;
}
}
re.Close();int s = Convert.ToInt16(Session["id"].ToString());if (s == 11)
{
Label10.Text = Session["ans"].ToString() + " / " + "10";Label9.Visible = true;
Label10.Visible = true;
//int x = Convert.ToInt16(Session["ans"].ToString());
//int y = (x/10) * 100;//y = Label10.Text;
}
////// SqlConnection con6 = new SqlConnection(@"server=123-9181FF31362SQLEXPRESS;user id=sampleu;pwd=Sampleu2;database=n;");
////// con6.Open();
////// SqlCommand cmd6 = new SqlCommand("SELECT CONVERT(int, 10*RAND()) from n3 where sno='" + Convert.ToInt16(Session["id"].ToString()) + "' ", con6);
////// SqlDataReader re6;
////// re6 = cmd6.ExecuteReader();
////// //select top 5 * from Employee order by NEWID()
//////// SELECT FirstName,LastName
////////FROM Person.Contact
////////TABLESAMPLE SYSTEM (10 PERCENT)
////// while (re6.Read())
////// {
////// Label1.Text = re6[0].ToString();
////// }
////// con6.Close();
}
}
View 3 Replies
View Related
Apr 10, 2008
I would like to know the best way to count and display the number of rows in a given database table called memberinfo.
This should tell me how many members I have right?
Thanks
View 6 Replies
View Related
Jun 2, 2003
Hi,
I need to import data from another server on recurring basis. Before inserting the data, I need to perform some checking e.g. check the last update date and time.
I am thinking of scheduling SQL job that run SQL Query. The SQL query will make use of cursor to check each row, to decide what to do with the imported data
Is it the right way to import the data? However I did not know how to select data from another server using T-SQL. Can help? I am using SQL 2000
Thanks in advance
Regards,
Christine
View 8 Replies
View Related
Jul 19, 2004
Hi,
I am trying to insert 9 rows into an table at the same time. My situation is this...
I have a survey page. There are 9 parts with each part ment for an individual person. Each part has 8 questions, and each part has the same 8 questions
The questions are answered using one of the answers in a drop down box.
So when the surveyer clicks submit, all the 9 parts should be entered into the table.
If this is confusing, I have the form up on the Internet at...
http://www.lavenderlane.ie/wage_survey_test.asp
I can insert one part no problem, (when I reduce the form to only 1 part) but i need to insert all of the 9 parts simultaneously. I reckon its some sort of for loop but if u could help me out i would appreciate it!
Thanks a lot
View 12 Replies
View Related
Jul 16, 2013
i am deleating 8 Million rows from my database,I am wondering how to control T-Log,also I heard something about row lock and table lock
View 4 Replies
View Related
Jul 19, 2006
Hello,I want to select the names and number of rows of all tables in thecurrent database, whose name starts with 'sys'my query is:select o.[name], sum(i.[rows]) as numbersfrom sysobjects oinner join sysindexes ion (o.[id] = i.[id])where o.[name] like 'sys%'and i.indid=1group by o.[name]the result of the query is (depending of the database) :name numberssysaltfiles 14syscharsets 114syscolumns 4934syscomments 2035sysconfigures 38sysdatabases 7sysdepends 5524sysdevices 6sysfilegroups 1sysfulltextcatalogs 0sysfulltextnotify 0sysindexes 98syslanguages 33sysmessages 3795sysobjects 1285syspermissions 806sysproperties 0sysreferences 0sysservers 1systypes 26sysusers 14sysxlogins 3But when I count the number of rows of "sysobjects", I getnumbers=1298, which is different from the result displayed above andsame goes for "syscolumns".I also tried "dbcc updateusage [0]" to update the SQL Server but Ididnt help me.Can anyone please advice me on this behaviour?
View 2 Replies
View Related
May 24, 2007
Hello everyone,
I'm trying to create a performant script to copy records from a table in a source database, to an identical table in a destination database.
In SQL 2000, I used to create a little lookup which did a count using certain fields. If the record was missing, I executed an INSERT query, otherwise an UPDATE query. The result was that the table on the destination side was always up to date. Duplicate rows were out of the question.
This was, if I'm not mistaking, a Data Transformation, using a bit of custom VBA code to govern the transfer. For each source row, the custom code was executed. Depending on the result of the custom code, a different query was launched.
Now I'm trying to do the same using SSIS in SQL 2005. Is there a task which does this for me, or do I have to script again? In the latter case, which type of task would I use?
(I thought of the Script Task, but then I would need to set up quite a bit myself.)
Thank you,
Bram
View 1 Replies
View Related
Dec 12, 2006
Hi All,
I have a c# project with an sql express database which is bound to a datagridview via a dataset.
I would like to allow the users to import data into the database from a text file.
How does one go about adding rows and filling in the column data programatically? Do I add the to datagridview? the database? the bindingsource?
Thank you,
Paul
View 4 Replies
View Related
Aug 16, 2006
Hi,
is there anyway to insert all the rows from a dataset to SQL Server table in a single stretch..
Thanks
Anz
View 1 Replies
View Related
Dec 30, 2006
Hi, how do i do a select statement with asp.net to return a record if a field is null. I have the following code:
SqlCommand cmd = new SqlCommand("SELECT * FROM Categories WHERE ParentId = @ParentId", cn);.Parameters.Add("@ParentId", SqlDbType.Int).Value = parentId != null ? (object) parentId : DBNull.Value;cn.Open();
The variable parentId is a nullable int. However when i pass in a null value it doesn't return anything even though there are records in the database that have a null value for the ParentId field.
Appreciate if someone could tell me what i am doing wrong. Thanks
View 6 Replies
View Related
Jun 25, 2007
Hi guys,
Just trying to select a set of Articles from a SQL Server Database. The Articles all have a Category ID which is stored in another table (as an Article could be in more than one Category). I want to select the Top 3 Articles in a Category. At the moment I have as my SQL;
"SELECT TOP 3 f.ArticleID, f.Heading, f.Summary, f.WrittenDate, f.ArticleURL FROM feedTable f LEFT JOIN Categories c ON f.ArticleID = c.ArticleID WHERE c.CategoryID=" + CategoryID + " AND c.ArticleID<>" + id + " ORDER BY c.CategoryID"
Which seems to work to an extent in that I do get three articles in the same Category appearing. However, there are sometimes duplicates appearing, so I need to incorporate a DISTINCT clause to the above. I'm not sure where to put this in though. Any ideas?
Thanks.
View 6 Replies
View Related
Jul 27, 2007
have created a Database Application in Java and display all the records in tabular format of one Table. This table have Millions of Rows, If I run Select * from Table, then my Machine not responding, so Now I wants to add paging of 1000 rows at one time.
Is there are any option/query to read block of rows at one time and then query again for next page ?
i.e In MYSQL have LIMIT clause with Select Statement
Please let me know..
Database : SQL Server 2000/2005,
Thanks in Advance
Laxmilal
View 3 Replies
View Related
Mar 28, 2007
Hello All,
Doe anyone know if any limitations with SQL Server Express may be causing this?
I have an application (a web service hosted on my local PC) that parses an InfoPath form and submits the data to a database (SQL Server Express). The problem I'm have is that new records are not always inserted into the database when I submit. There is an autoincrement ID field and I observed that every other record was successfully inserted (a day ago) and today I observed that the records were inserted intermittently. However, when I run the same application on a laptop, the records are inserted each time.
I posted the associated code on the Data Access forum but it occurred to me that it may be because of the nature of SQL Server Express.Any suggestions would be much appreciated. Thanks!
View 1 Replies
View Related
Sep 22, 2007
(I moved this thread from datagrid area) I have a sql database that has individual records consisting of name, date, hours worked among other fields.Date and name is part of a unique identifier, so there can NOT be two records for the same person for the same date. My users need a grid view that displays days worked in ONE LINE per user. I have gotten close, but can't quite get the last part. Ive tried group by, distinct, and with rollup and no luck.TABLE:dan 12/13/2012 12:00:00 AM9.123dan 12/14/2012 12:00:00 AM3.123123cara 12/12/2012 12:00:00 AM4.222cara 12/16/2012 12:00:00 AM3.3333cara 12/17/2012 12:00:00 AM2 CODE: Select distinct(name), (select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Sunday')as Sunday, (select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Monday')as Monday, (select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Tuesday')as Tuesday, (select
(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =
YT.hours and datename(dw, date)='Wednesday')as Wednesday, (select
(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =
YT.hours and datename(dw, date)='Thursday')as Thursday, (select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Friday')as Friday, (select
(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =
YT.hours and datename(dw, date)='Saturday')as Saturday,(select sum(hours)from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours) as Totalfrom dbo.testtime YTgroup by date, name, hours RESULTS: cara NULL NULL NULL 4.222 NULL NULL NULL 4.222cara NULL 2 NULL NULL NULL NULL NULL 2cara 3.3333 NULL NULL NULL NULL NULL NULL 3.3333dan NULL NULL NULL NULL NULL 3.123123 NULL 3.123123dan NULL NULL NULL NULL 9.123 NULL NULL 9.123 Like I said, I am SO close, I just need it to look like;NAME SUN MIN TU WED TH FR SA TOTAL cara 3.333 2 4.222 9.555
dan 9.125 3.125 12.5 TIAdan
View 6 Replies
View Related
Apr 14, 2008
Hi,
Good morning to all.My table: User_Group_Map(UserID UNIQUEIDENTIFIER,GroupID UNIQUEIDENTIFIER)
Now, I want to write one stored procedure that can insert rows into the above table, but more number of rows at-once.
Means, the program should allow multiple insertions without the need to call the stored procedure from front-end more number of times.
Can anyone please help me on this...
Thanks in advance...Ashok kumar.
View 3 Replies
View Related
Jun 14, 2007
I'm using Visual Studio 2005 and SQL Server 2005. I am creating a report to put on the Internet using C# and other .NET features. I'm building several charts using database information extracted from Microsoft Excel. I can make charts based on the data from columns using the categories, series, and values on the Data tab of chart properties. However, when I create a query that grabs a record ( a row) from a database, it forces me to use the field values even though each field contains only one value.
Basically, I want to take a row from a database and make it my x-axis data values and another row (record) from a database and make it my y-axis data values.
I'd prefer not to change the format in the database, if possible. Thanks in advance.
View 1 Replies
View Related
Sep 23, 2011
My Client Accidently Deleted Somes Rows From Database Now. Now We are Struggling For Almost 2 Days To Get Them Backup. I Even Checked LDF File From Notepad It Have Those Rows But Not Formatted. (Some Similar Text From Some Column Which Got Deleted.)And The Database has no Backup which i Go to Task -> Restore...Server is Running on Sql Server 2008.
View 7 Replies
View Related
Mar 13, 2007
When i click upload image button when my database table has no any row, the selected image is saved(one row saved in table). If i continue and select a different image, i get no error sa if the image has been saved but when i view the images i have been saving, its strange even if i saved 10 records they all contain the first image that i saved. In short only the first image is saved the rest of the rows are just duplicates of the first row. so it basically becomes a table of ten rows but with same data rows(same image). Code is below.
Protected Sub btnupload_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim intLength As Integer
Dim arrContent As Byte()
If FileUpload.PostedFile Is Nothing Then
Lblstatus.Text = "No file specified."
Exit Sub
Else
Dim fileName As String = FileUpload.PostedFile.FileName
Dim ext As String = fileName.Substring(fileName.LastIndexOf("."))
ext = ext.ToLower
Dim imgType = FileUpload.PostedFile.ContentType
If ext = ".jpg" Then
ElseIf ext = ".bmp" Then
ElseIf ext = ".gif" Then
ElseIf ext = "jpg" Then
ElseIf ext = "bmp" Then
ElseIf ext = "gif" Then
Else
Lblstatus.Text = "Only gif, bmp, or jpg format files supported."
Exit Sub
End If
intLength = Convert.ToInt32(FileUpload.PostedFile.InputStream.Length)
ReDim arrContent(intLength)
FileUpload.PostedFile.InputStream.Read(arrContent, 0, intLength)
If Doc2SQLServer(txtTitle.Text.Trim, arrContent, intLength, imgType) = True Then
Lblstatus.Text = "Image uploaded successfully."
Else
Lblstatus.Text = "An error occured while uploading Image... Please try again."
End If
End If
End Sub
Protected Function Doc2SQLServer(ByVal title As String, ByVal Content As Byte(), ByVal Length As Integer, ByVal strType As String) As Boolean
Try
Dim cnn As Data.SqlClient.SqlConnection
Dim cmd As Data.SqlClient.SqlCommand
Dim param As Data.SqlClient.SqlParameter
Dim strSQL As String
strSQL = "Insert Into Images(imgData,imgTitle,imgType,imgLength,incident_id) Values(@content,@title,@type,@length,@incident_id)"
Dim connString As String = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|safetydata.mdf;Integrated Security=True;User Instance=True"
cnn = New Data.SqlClient.SqlConnection(connString)
cmd = New Data.SqlClient.SqlCommand(strSQL, cnn)
param = New Data.SqlClient.SqlParameter("@content", Data.SqlDbType.Image)
param.Value = Content
'cmd.Parameters.AddWithValue(param)
cmd.Parameters.AddWithValue("@content", Content)
param = New Data.SqlClient.SqlParameter("@title", Data.SqlDbType.VarChar)
param.Value = title
cmd.Parameters.Add(param)
param = New Data.SqlClient.SqlParameter("@type", Data.SqlDbType.VarChar)
param.Value = strType
cmd.Parameters.Add(param)
param = New Data.SqlClient.SqlParameter("@length", Data.SqlDbType.BigInt)
param.Value = Length
cmd.Parameters.Add(param)
cmd.Parameters.AddWithValue("@incident_id", id.Text)
cnn.Open()
cmd.ExecuteNonQuery()
cnn.Close()
Return True
Catch ex As Exception
Return False
End Try
End Function
View 1 Replies
View Related
Jun 12, 2007
I am using VS2005 to construct a website. I have a sql database with 3 datasets. One of the table adapters is called Proudcts and has the following fields. ProductItem, Description, Price, ProductID, PackSizeI want to be able to see a summary of the products (there are thousands of them) using one or more words (or partial words) in one text box to search in only 3 fields (ProductItem, Description, ProductID, ). This needs to show only records which contain the search criteria in a gridview?This is such a basic requirement for a website, and can be found on many sites, but I haven't found how to do it.Thanks, Bri
View 7 Replies
View Related
Aug 12, 2015
I am trying to use the following Query to create the table Agents and add rows to it.
USE REMAXCLASSIC;
IF OBJECT_ID ('dbo.Agents', 'U') IS NOT NULL
DROP TABLE Agents;
GO
CREATE TABLE Agents
[Code] ....
I get the following error messages:
Msg 102, Level 15, State 1, Line 34 Incorrect syntax near '0.25'
Msg 105, Level 15 mark after the character string ');
View 2 Replies
View Related
Sep 5, 2007
Hi,
In Crystal Reports, you could suppress the printing of a report if no rows were retrieved from the database server (ie: zero pages would be sent to the printer). This was done by opening the Report Properties dialog in the report designer and setting the "Suppress Printing if No Records" to true.
Is there a way I can reproduce this behavior in SQL 2005 Reports?
Thanks!
Stephen
View 2 Replies
View Related
Nov 16, 2015
I need to look at all tables in a database that has a column name of GEO
Then look for all values in each table where the GEO value is NULL and delete each of the records found...
View 6 Replies
View Related
Jan 11, 2008
Mean_A Std_Dev_A Mean_B Std_Dev_B Mean_C Std_Dev_C X_Co Y_Co Posn
71.7
9.36
73.23
3.62
70.87
4.06
12
14
1
72.69
8.02
79.39
2.66
73.39
5.16
13
15
2
74.37
10.27
77.33
4.10
79.33
3.44
14
16
3
The Above is my database, I need help in retrieving the X_Co and the Y_Co using values of rcv_A, rcv_B and rcv_C to compare with the Mean_A, Mean_B, Mean_C. The values of rcv_A, rcv_B and rcv_C are instances of values that are not exact of the mean columns , and we want is to compare it against our database and retrieve the row that is the closest to the rcv_A, rcv_B and rcv_C.
Here is an example of what i need. Let's say my rcv_A = 71, rcv_B = 73 and rcv_C = 70.8, so the row with mean value closest would be row 1, followed by row 2, then row 3.
So the result i hope to retrieve is in order of the closest value and i only need the X_Co and Y_Co.
This is what i want
X_Co Y_Co
---------------------------
12 14
13 15
14 16
So anyone please can help me in querying for the above results? Thanks
View 5 Replies
View Related
Apr 16, 2015
I am using SQL Server 2012 SE.I am trying to delete rows from a couple of tables (GetPersonValue has 250 million rows and I am trying to delete 50Million rows and GetPerson has 35 Million rows and I am trying to delete 20 million rows). These tables are in TX replication.The plan is to delete data older than 400 days old.
I tried to move data to new tables from the last 400 days and it took me like 11 hours. If I delete data in chunks of 500000 then its taking a long time to rebuild indexes(delete plus rebuild indexes 13 hours). Since I am using standard edition partition wont work.
find ddl below:
GO
CREATE TABLE [dbo].[GetPerson](
[GetPersonId] [uniqueidentifier] NOT NULL,
[LinedActivityPersonId] [uniqueidentifier] NOT NULL,
[CTName] [nvarchar](100) NULL,
[SNum] [nvarchar](50) NULL,
[PHPrimary] [nvarchar](50) NULL,
[code]....
View 1 Replies
View Related
Oct 28, 2014
I have 3 tables...
JobRequirements (A)
JobID int
QualificationTypeID int
EmployeeQualifications (B)
EmployeeID int
QualificationTypeID int
Employee (C)
EmployeeID int
EmployeeName int
I need to return a list of all employees fit for a specific job ... The criteria is that only employees who have all the JobRequirements are returned. So if a job had 3 requirements and the employee had just 2 of those qualifications, they would not be returned. Likewise, the employee might have more qualifications than the job requires, but unless the employee has all the specific qualifications the job requires they are not included. If an employee has all the job qualifications plus they have extra qualifications then they should be returned...
How to only return those records where all the child records are present in the other table..
View 5 Replies
View Related
Feb 24, 2006
Hi,
I have an application where I'm filling a dataset with values from a table. This table has no primary key. Then I iterate through each row of the dataset and I compute the value of one of the columns and then update that value in the dataset row. The problem I'm having is that when the database gets updated by the SqlDataAdapter.Update() method, the same value shows up under that column for all rows. I think my Update Command is not correct since I'm not specifying a where clause and hence it is using just the value lastly computed in the dataset to update the entire database. But I do not know how to specify a where clause for an update statement when I'm actually updating every row in the dataset. Basically I do not have an update parameter since all rows are meant to be updated. Any suggestions?
SqlCommand snUpdate = conn.CreateCommand();
snUpdate.CommandType = CommandType.Text;
snUpdate.CommandText = "Update TestTable set shipdate = @shipdate";
snUpdate.Parameters.Add("@shipdate", SqlDbType.Char, 10, "shipdate");
string jdate ="";
for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
{
jdate = ds.Tables[0].Rows[i]["shipdate"].ToString();
ds.Tables[0].Rows[i]["shipdate"] = convertToNormalDate(jdate);
}
da.Update(ds, "Table1");
conn.Close();
-Thanks
View 4 Replies
View Related
Nov 8, 2007
Hi All,
I am using sql server 2005. I stuck out in a strange problem.
I am using view in my stored procedure, when I run the stored procedure some of the rows get skipped out means if select query have to return 10 rows then it is returning 5 rows or any other but not all, also the records displyaing is randomly coming, some time it is displaying reords 12345 next time 5678, other time 2468.
But if I run seperately the querys written in SP then it returns all the rows. Please give me solution why it is happening like this.
There are indexes in the tables.
Once I shrink the database and rebuild the indexes, from then this problem is happening. I have rebuild the indexes several time, also updated the statistics but nothing improving.
But nothing is improving
View 7 Replies
View Related