Viewing 15 posts - 46 through 60 (of 7,545 total)
I may not fully understand your requirement, but either:
(1) A CHECK constraint
or
(2) an index definition
can be created to do what you want to do.
For example, if you just want to make...
October 7, 2024 at 6:38 am
I'd flip the check around: check first for = 1 as 'True' else 'False'. That way NULL will show as false, if a NULL happens to slip in there.
Use the...
September 19, 2024 at 10:34 pm
You can use ctes, which will create virtual tables, but no actual physical tables:
;WITH TempA AS (
SELECT
InvoiceNo, Date,Type,Code
...
September 18, 2024 at 3:39 pm
I would use STUFF for this, as most custom-fitted to do this task:
SELECT s_Result,
STUFF(s_Result, 1, CASE s_credit_card_type
...
September 16, 2024 at 3:13 pm
;WITH cte_1 AS (
SELECT *, ROW_NUMBER() OVER(PARTITION BY HH ORDER BY HH) AS row_num
FROM MyTable
)
SELECT
...
September 13, 2024 at 2:04 pm
There might be some fair overhead to getting the current length of a text column. If you really have to have that, add a column to...
August 30, 2024 at 3:59 pm
There might be some fair overhead to getting the current length of a text column. If you really have to have that, add a column to the...
August 30, 2024 at 3:31 pm
Actually "<" is NOT a safe way to check for not space. CR and LF are both not "<" a space.
select case when char(10) > space(1) then 'LF ' else...
August 29, 2024 at 7:54 pm
References in SQL are to object names. The code will resolve based on the name.
A rename can't happen while the table is being queried, because a schema lock is in...
August 27, 2024 at 7:02 pm
I agree. Why the "need" to jump to such a huge number?
August 20, 2024 at 8:22 pm
Correct. You'd have to use decimal(38, 0) or some other larger value type rather than bigint.
August 19, 2024 at 8:07 pm
So you deliberately set the value so that it would get too large for a bigint ... and that seems to be your error.
Not sure why you felt the need...
August 19, 2024 at 3:08 pm
Theoretically @@IDENTITY value could be too large for a bigint. Hard to imagine actually using enough values to go past 19 digits, but it's theoretically possible.
Btw, you should get @@IDENTITY...
August 19, 2024 at 2:19 pm
Be sure you set and are using the correct variable. In your original code, you use "@tblName" but you never set the value of that variable. That's why I used...
August 16, 2024 at 8:14 pm
You can't use a variable in a DROP TABLE statement in SQL.
Change it to:
SET @dropCommand = N'DROP TABLE dbo.' + @tableName
August 16, 2024 at 5:28 pm
Viewing 15 posts - 46 through 60 (of 7,545 total)