Viewing 15 posts - 1,006 through 1,020 (of 1,923 total)
Chrissy321 (1/26/2011)
ISNUMERIC(CONVERT(decimal(6,2),Field1)) returns 1 for all fields.
ISNUMERIC lies 😎 Don't use ISNUMERIC to validate integer values in a Field.
Use this : LIKE '%0-9%'
January 26, 2011 at 11:06 am
This will do it:
SELECT Sector, Region, employee_num_tech AS [Technician #],
ISNULL ( SUM (DATEDIFF(mi,wow_start,wow_end)) ,0) AS [TOTAL MINS], DATEPART(yyyy, date_identified) AS YEAR, DATENAME(mm,date_identified) AS MONTH
FROM TABLE 1
I have used the ISNULL...
January 25, 2011 at 10:31 am
Andy Lucas (1/25/2011)
Hope this helps.
One advice (i know people don't like advices, but i will have to tell it out :(), Please do not use a code in LIVE environment...
January 25, 2011 at 9:27 am
Try this out (the code i added/edited has been wrapped around /* START OF ADDITION */ and /* END OF ADDITION */)
Declare @CurrID int,@MaxID int
Declare @DBs Table (DBID...
January 25, 2011 at 9:24 am
:blush: thanks for the feedback Tom!
January 25, 2011 at 3:55 am
I had my mind at sea while using that. A much tweaked version of the UPDATE statement (uses the same logic but with some tweak)
UPDATE FT
SET FT.Full_name =
...
January 25, 2011 at 2:55 am
How about this ?
DECLARE @First_Table TABLE
(
ID INT,
Full_name VARCHAR(250)
)
INSERT INTO @First_Table (ID)
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3
DECLARE @Second_Table TABLE
(
...
January 25, 2011 at 2:45 am
Gianluca Sartori (1/25/2011)
How fast, Mr. Coffe!
I may be fast, but u are so precise Sir!! mine will produce an extra hyphen for empty strings, your's wont!! Beautiful!!
BTW, Happy New Year,Gian!...
January 25, 2011 at 2:19 am
How about this?
DECLARE @Command NVARCHAR(MAX)
DECLARE @DBName NVARCHAR(128)
SELECT @DBName = DB_NAME()
SELECT @Command = N'Declare
@ObjName Varchar(255) ,
@indexname varchar(255),
@Dbnames Varchar(255),
@Db_id varchar(255),
@Tab_id int,
@Fragmentation int,@Pages int
Select @Pages=10000
Select @Fragmentation=30
Select @Dbnames = '''+ @DBName+'''
--set @dbname=''test''
set @db_id=db_id(@dbname)
if exists...
January 25, 2011 at 2:16 am
How about this ?
SELECT REPLACE ( (SM_Outer.FORMAT_NAME + ' - ' +
STUFF ( ( SELECT ' ('+FORMAT_ID + ') '
...
January 25, 2011 at 2:08 am
You cannot concatenate variables in parameters ; concatenate the data as a single variable using this SET @Variable = 'some data' + @DBNAME + 'remaining data' and then pass the...
January 24, 2011 at 10:57 pm
Jeff Moden (1/24/2011)
ColdCoffee (1/24/2011)
January 24, 2011 at 7:04 pm
Please read about TRY CATCH block from MSDN ONline or Books Online to know about the scenarios where TRY will enter CATCH when an error is encountered. NOT ALL...
January 24, 2011 at 7:02 pm
The below chunk will assign a unique number to each group (here as we are using GROUP BY, we will have unique values from GroupedCol column). NEWID() will produce UNIQUE...
January 24, 2011 at 6:58 pm
Viewing 15 posts - 1,006 through 1,020 (of 1,923 total)