Skip to content
Advertisement

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 datepart(iso_week, appointment_date) as week_of_yr which gets me part of the

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 information to

Add an autoincrementing ID column to an existing table with Sqlite

Using Sqlite, I want to add an auto-incrementing ID column to an existing table which had previously no ID: How to do it properly? I have this error: sqlite3.OperationalError: near “auto_increment”: syntax error Answer An SQLite table cannot modified in a significant manner using alter table once it has been created. One common popular suggestion is to create a new

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 work

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

Advertisement