Skip to content

Updating DATAGRID row to save to SQL

Hi Guys I am trying to understand how to save and edited row to the database private void BudgetGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { SqlCommand gridcmd = new …

Select from two tables with group by date

I have two tables: Table t1: So from this table I want to get count field Id for each day. For this I use next query: It’s work good. So next table is t2. To select data by date from this table I use next query: It’s also work good. So my purpose is merge these two queries into one

Convert iso_week to calendar date in SQL

I’ve been searching though the archives without finding what I am looking for- I’d be happy for some guidance. I have a data set where I want to report aggregated number of appointments by provider (STAFFID) and work week, the latter defined by the week’s Monday date. I’ve played with …

Update a single column on multiple rows with one SQL query

I need to update a single column over a thousand rows in the database. Normally when I need to do this, I’ll do the following: I feel like there should be a way to do this easily, but after searching around online, I cannot find a solution. What I was hoping for was this: An important piece of informati…

LAG functions and NULLS

How can I tell the LAG function to get the last “not null” value? For example, see my table bellow where I have a few NULL values on column B and C. I’d like to fill the nulls with the last non-null value. I tried to do that by using the LAG function, like so: but that doesn’t quite wo…

how to get the ID of the record that is update in C#

I am able to get a sql query that can return the ID of a record that is update in the Database; that ID is needed to update other records. but I don’t know how to get that updated ID value in C#. Answer I think you’re really asking how do you retrieve the resultset returned by an INSERT or