Convert SQL request to Hibernate Criteria

I would like to convert this SQL into either Criteria. I am sorry I don’t know which one to use since I’m new to Hibernate. I’ve done some research, and it looks like both are needed to achieve what I wanted. My Sql Request select * from change.pade pade, change.pade_etat rdp, par.safsit safsit, par.saf saf where pade.sir = “1245454” and…
Read more

Php foreach date

I got this: foreach($result_set_cw_01 as $result_cw_01) { $newcw = mt_rand(1, 52); $week = $newcw; $year = date(“Y”); $time = mktime(0,0,0,1,1,$year) + ($week * 7 * 24 * 60 * 60); $time = $time – ((date(‘N’, $time) – 1) * 24 * 60 * 60); $startWeek = date(‘Y-d-M’, $time); $endWeek = date(‘Y-d-M’, $time + (6 * 24 * 60 * 60));…
Read more

VBA Change Sql Timeout

I have the code below which works well in sql (copy code from immediate window into sql), however in instances where there is high usage on the server, it times out with around 41 Seconds. Is there an easy method to increase the timeout to around 2 mins? Sub ROW21() With ProcImpReview Dim LASTCOL As Long SQLSTR = “” LASTCOL…
Read more

How to check if a field is FK in another table?

I have the following table: CREATE TABLE customers ( customerid integer NOT NULL, customerid2 text NOT NULL, …. ) How can I check if customerid2 is used as FK in other tables? suppose I will drop this column, before it execute the actual drop – it checks who uses it. How do I perform that check manualy? Source: sql

How do I pass values from a button to another button sub

Here is my problem, I don’t know how to pass these values, I want to get the row value from here: Public Sub DataGridView2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick If e.RowIndex >= 0 Then Dim row As DataGridViewRow row = Me.DataGridView2.Rows(e.RowIndex) Label12.Text = row.Cells(“title”).Value.ToString Label13.Text = row.Cells(“borrower”).Value.ToString Dim b As Date = row.Cells(“date”).Value Dim a = Format(b, “yyyy-MM-dd”)…
Read more

Converting full date into datetime in sql

Still relatively new to the sql language and need a little help and guidance.. I have a table which has the date in this format (2015-09-09 00:00:00) but the code i wrote pulls the date like this (Sep 21 2015 12:00AM), I would like the date to reflect like this (2015-09-09 00:00:00) UPDATE table1 SET [Column 0] = (SELECT CAST(RIGHT(LEFT([Column…
Read more

INSERT INTO syntax error in c#

please figure out the error in my code.it show syntax error INSERT INTO statement. OleDbCommand cmd = new OleDbCommand(“INSERT INTO tbbill(invoice,datetime,custm,total,tax,grand)VALUES(” + Convert.ToInt32(txtinvoice.Text) + “,'” + dateTimePicker1.Value.ToString(“yyyy/MMM/dd”) + “‘,'” + Convert.ToString(txtcn.Text) + “‘,'” + txtttl.Text + “‘,'” + Convert.ToInt32(cmtax.Text) + “‘,'” + txtgrdttl.Text + “‘)”, con); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); con.Close(); Source: sql

Workaround: Using LAG command inside SUM command

I have query which returns the following result: — Get current int_type and compare with next int_type. If they are different, put 1. Then sum all results select CASE WHEN int_type <> LAG(int_type) OVER (ORDER BY id) THEN 1 END as next_int_type from data Output: 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0…
Read more