[Solved] Error inserting date and time in SQL Server 2005 datetime c#? [closed]

You should ALWAYS use parametrized queries – this prevents SQL injection attacks, is better for performance, and avoids unnecessary conversions of data to strings just to insert it into the database. Try somethnig like this: // define your INSERT query as string *WITH PARAMETERS* string insertStmt = “INSERT into survey_Request1(sur_no, sur_custname, sur_address, sur_emp, sur_date, sur_time, … Read more

[Solved] Unable to get data from Sql Server 2005 (connection time out exception)

As the jTDS FAQ states, the URL must be in the form jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;…]] Infering from your connection: mindmill is the name of your_computer/server where Sql Server 2005 is installed. 1433 is the (default) port to connect with Sql Server 2005. employ is the database name. mahesh is your user and password to connect to server. … Read more

[Solved] sql update (help me )

First, figure out which records need to be updated: select * from tbl_order o inner join tbl_group g on g.grp_id = o.grp_id inner join tbl_indicator i on i.grp_nbr = g.grp_nbr and i.sect_nbr = g.sect_nbr where g.indicat != i.indicat Now, modify the query to update those records with the correct grp_id. Notice that I’ve added an … Read more

[Solved] Insert an image in a column of a table that already has 5 columns

I’m not sure you can do that the way you’re trying, Why don’t you load the image into a variable then use that variable in your insert statement: declare @image varbinary(max) set @image = (SELECT BulkColumn from Openrowset( Bulk ‘C:\Users\Yassine-Kira\Desktop\Templates\ProductImg\elite-book_tcm_133_1096796.png’, Single_Blob) as BikeImage) insert into dbo.Produit values (‘Pc portable’, ‘HP EliteBook série p’, ‘Un ordinateur…’, … Read more

[Solved] need sum of value based on category [closed]

What you need is calculating rolling total. The fastest way in SQL Server 2005 / 2008 / 2008 R2 I know is described here: https://stackoverflow.com/a/13744550/1744834. You have to have unique secuential column inside each category to use this method, like this: create table #t (no int, category int, value int, id int, primary key (category, … Read more

[Solved] How to find dates between two dates in SQL Server 2005

This will work in sqlserver 2005: DECLARE @startdate datetime DECLARE @enddate datetime SELECT @startdate=”2015-12-04″, @enddate=”2015-12-07″ ;WITH N(N)AS (SELECT 1 FROM(SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1)M(N)), tally(N)AS(SELECT ROW_NUMBER()OVER(ORDER BY N.N)FROM N,N a,N b,N c,N d,N e,N f) SELECT top (datediff(d, @startdate, @enddate) + 1) dateadd(d, N – 1, … Read more