Viewing 15 posts - 76 through 90 (of 2,617 total)
With this query:
;WITH fn as
(
select N
from dbo.fnTally(0, 300) fn
)
SELECT dd.PROJECT, dd.HOLE_ID, fn.N + 0.0 DEPTH_FROM,
...
May 7, 2024 at 4:12 pm
I'm not the OP. The UDF (dbo.fnTally) is a well know one by Jeff Moden and the OP is using this in his original post.
The...
May 7, 2024 at 3:59 pm
Thanks Phil. Interesting maybe. The real answer is don't use cursors 🙂
It's nothing to do with the cursor, it's how table variables work. Despite being declared within a block,...
May 7, 2024 at 3:36 pm
Not sure exactly what you want, but maybe something like this?
Create some data:
-- Creating the table
CREATE TABLE DrillingData (
PROJECT NVARCHAR(50),
...
May 7, 2024 at 3:20 pm
Not sure exactly what you want, but maybe something like this?
Create some data:
-- Creating the table
CREATE TABLE DrillingData (
PROJECT NVARCHAR(50),
...
May 7, 2024 at 1:58 pm
I'm not sure I quite understand, but maybe something like this:
INSERT INTO dbo.[table1] (ProductCode, ProductionDate, SerialNumber)
SELECT 'A' + RIGHT('00000' + CAST(CAST(RIGHT(MAX(ProductCode), 6) AS INT) + ROW_NUMBER() OVER...
April 24, 2024 at 4:57 pm
from ChatGPT
Query Explanation
Given Tables:
Table1 | Table2 |
---|---|
A | B |
B | C |
C | D |
SELECT t1.name, t2.name
FROM Table1 t1
INNER JOIN Table2 t2
...
April 24, 2024 at 9:59 am
Have you got an example of the sort of data you'd like to insert?
April 24, 2024 at 9:54 am
You could import them all as nvarchar then try to work out where the error is.
You need to have the columns consistent throughout the entire file.
April 23, 2024 at 3:52 pm
If you want to find the query you could run something like this soon after the problem occurs.
DECLARE @Database sysname = 'Test'-- Specify your database
SELECT DB_NAME(qt.dbid) AS...
April 18, 2024 at 3:32 pm
Please consider learning standard SQL. We don't have an IFF() construct; that was spreadsheets and perhaps some nonrelational languages. Take the time to write everything out as a CASE...
April 17, 2024 at 9:40 pm
Have you checked the SQL Server logs?
April 17, 2024 at 4:31 pm
As someone who used temp table and had a lot of issues with it, I highly recommend start creating table into DB and use it.
TempDB is good only if...
April 17, 2024 at 4:10 pm
I have resorted to setting the DATEFIRST in the SQL Agent job, but I still want to know WHY SQL agent and Query window behave differently.
Different users can be...
April 15, 2024 at 3:15 pm
Viewing 15 posts - 76 through 90 (of 2,617 total)