Export from SQL Server to Excel
SELECT [Date], [Partner], [Weight], [TotalCost], [ProductGroupID] FROM Z_STOCK_PARTNERS_2 ORDER BY `ProductGroupID`
SELECT [Date], [Partner], [Weight], [TotalCost], [ProductGroupID] FROM Z_STOCK_PARTNERS_2 ORDER BY `ProductGroupID`
How about this one? (Because you posted minimal info, I reserve the right to create my own DDL as I interpret). IF OBJECT_ID (‘tempdb..#’) IS NOT NULL DROP TABLE #sales GO CREATE TABLE #sales (Dte datetime ,amt int ,id int ,rownum int identity PRIMARY KEY ) INSERT INTO #sales SELECT ‘9/1/17’,1200, 987 INSERT INTO #sales … Read more
|| is not valid Transact-SQL syntax. You need to user ‘OR’ or ‘AND’ Example IF @logpath is not null OR @ptd is not null BEGIN — do something END
There are other things wrong with that code but I’ll concentrate on the two that most directly pertain to your stated issue. Firstly, you have this within your SQL code: Img = ‘@Spic’ That is wrong. If you want to use the value of a variable in VB, would you wrap the name of the … Read more
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
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