Get max() value from distinct row value sql server

I need to select max value for different rows by same column: Here’s my table id | visited_count ————+————– 01071400005 | 1 01071400005 | 5 01071400006 | 1 01071400006 | 3 I need to show 01071400005 and 01071400006, so I tried below code but it only selects 01071400005. SELECT MAX(visited_count) – 1 from tbl_all_purple_flag_level where […]

Need to build table in 3 columns

Edit for clarity: I know the code has 2 columns, one for title and one for date, I am trying to change the code so it displays 3 events per row. I am new to development and I am trying to take an ASP control used in a Sitefinity 6.1 website that currently takes data […]

Order By not working

I am using this stored procedure for custom paging in a gridview, and I am getting an error when I use ORDER BY ALTER PROCEDURE [dbo].[spGetAllTender] @pageIndex int = 0 , @pageSize int = 0 AS BEGIN SET NOCOUNT ON; /* Set Starting Row Index and Ending Row Index */ ————————————————- DECLARE @startRowIndex int = […]

insert binary(16) with executemany

I store md5 hashes as binary(16) in a MSSQL Database. I need to insert several thousand values with pymssql, which is very slow if I insert the values one by one with cursor.execute() instead of cursor.executemany(). But the problem is, that i cannot insert binary data, because executemany takes my list of md5 hashes and […]

Porting a query with respect to SQLServer

I have a query in Vectorwise DB as, UPDATE current_load_details cld FROM date_dim dd SET current_date_sk = dd.date_sk ,batchstring = date_part(‘YEAR’, dd.dateval) || CASE WHEN length(date_part(‘MONTH’, dd.dateval)) = 1 THEN ‘0’ || date_part(‘MONTH’, dd.dateval) ELSE date_part(‘MONTH’, dd.dateval) END || CASE WHEN length(date_part(‘DAY’, dd.dateval)) = 1 THEN ‘0’ || date_part(‘DAY’, dd.dateval) ELSE date_part(‘DAY’, dd.dateval) END ,is_last_run_successful […]

SQL Server 2012 Setup Failed – Requires .NET 4

I have installed sql server 2012 but was unable to install SQL Server Data Tools and Management Studio. It seems to require the visual studio 2010 setup which I do not have with me. I have installed VS 2010 SP1 though, however it still seems to require setup though to install .net 4 which is […]

How can I create and authenticate users in asp.net mvc authentication?

I’m creating one asp.net mvc 4.0 application. in which I want to use default asp.net form authentication. I’ve created all required tables in ms sql for storing roles and username password. help me earliest possible. I’m stuck at this point.

How to save many pictures from SQL Server database to specific folder using vb.net

I’m new to vb.net and I have a problem to do my task.. Firstly, I have a project in vb.net that has a process button which, when clicked, will show a list of staff names from a SQL Server database (I’m using SQL Server 2008 R2) to a list view. Then I have copy button, […]

“Must declare the scalar variable” when trying to pass parameters to OleDbCommand/Connection from C#

I’m trying to use Parameters with my query for the first time and I keep receiving this error An unhandled exception of type ‘System.Data.OleDb.OleDbException’ occurred in System.Data.dll Additional information: Must declare the scalar variable “@SampleID0”. I’ve never used parameters and am trying to figure them out. I believe the part that says dbcmd.Parameters.AddWithValue(…) should be […]

In this stored procedure I'm getting error converting datatype varchar to datetime

Pls Help in this while I am executing this stored procedure I’m getting error Error Converting datatype varchar to datetime in the database that created as date only. Columns contains date datatype Lawcurdatefrm, Lawcurdateto Lawcomdatefrom,Lawcomdateto These four columns are of date datatypes My requirement is I need a records FromDate to ToDate Example For current […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.