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

Is it possible to write single query on two table which are not connected to each other?

A Cartesian join (note there is no JOIN condition). All possible combinations of records are in the results: tableA (charfield Char(2)) tableB (numberfield Number(1)) INSERT ‘A’ INTO tableA; INSERT ‘B’ INTO tableA; INSERT 1 INTO tableB; INSERT 2 INTO tableB; SELECT * FROM tablea CROSS JOIN tableb Results: charfield|numberfield ===================== A |1 A |2 B … Read more

Convert text to system date format [duplicate]

EDIT From SQL Server 2012 and later you might use the FORMAT function if you want to force a date into a formatted text: https://msdn.microsoft.com/en-us/library/hh213505.aspx With earlier versions you might use something like this: DECLARE @d DATETIME=GETDATE(); DECLARE @TargetFormat VARCHAR(100)=’DD/MM/YYYY’; SELECT CONVERT(VARCHAR(100),@d, CASE @TargetFormat WHEN ‘MM/DD/YYYY’ THEN 101 WHEN ‘DD/MM/YYYY’ THEN 103 –add all formats … Read more

Count within a time period

The query you require is a very simple SQL statement using the GROUP BY clause. Because you are asking information that needs grouping by date only and also information that needs grouping by date and by technician you should use GROUPING SETS. select year(closed) as year , month(closed) as month , Technician , count(*) as … Read more

T-SQL SEQUENCE runs out, no cycle, what happens?

The documentation you mentioned specifies what happens: “[…] throw an exception when its minimum or maximum value is exceeded” Regarding the error message you can find out using a simple Google search: https://www.google.com/search?q=t-sql+error+messages+sequence The fourth link is https://www.sqlshack.com/sequence-objects-in-sql-server/ and there you can find a screenshot of the error, which has the number 11728. Of course, … Read more