Viewing 15 posts - 1,756 through 1,770 (of 3,543 total)
Change
set @mysql = 'select count(*) from ' + @myname
select @mycnt = count(*) from @myane
set @mycnt = execute(@mysql)
to
set @mysql = 'select @mycnt=count(*) from ' + @myname
exec sp_executesql @mysql, N'@mycnt int...
October 3, 2006 at 10:04 am
Ah, OK
Besides any solution will require a SELECT/JOIN because of the INSERT
October 2, 2006 at 7:07 am
Heck, I only found out when I experimented before my first post
There is always something in SQL to catch me out
October 2, 2006 at 6:57 am
![]() | Don't use NOT EXISTS. It forces the whole table to be looked at because it has to check... |
October 2, 2006 at 6:49 am
If data consists of fixed values then use CASE statements and GROUP BY
If data consists of variable values then create a function to concatenate data for and use it...
October 2, 2006 at 6:22 am
But for uniqueness it is 4.
ie add 3 or 4 milliseconds to 13 milliseconds and you will get 17 milliseconds for both
October 2, 2006 at 2:04 am
The only way I can think of is to use temp table/table variable to store the unique key of the selected records plus IDENTITY column and update datetime using the...
September 29, 2006 at 7:19 am
Just some observations
You will not be able to update the new column in a set based update unless all of your dates are valid or SQL will stop at the...
September 28, 2006 at 6:45 am
You could try to reduce the rows selected in the Linked Server like this
UPDATE u
SET [LinkCol_1] = l.[LocalCol_1]
FROM OPENQUERY(LinkedServerName, 'SELECT [LinkCol_ID],[LinkCol_1] FROM DBName..TblName WHERE LinkCol_3]=''ABC''') u
INNER JOIN...
September 25, 2006 at 7:11 am
Something like this
IF ((SUBSTRING(COLUMNS_UPDATED(),1,1) & 128) > 0 OR
SUBSTRING(COLUMNS_UPDATED(),2,1) > 0 OR
(SUBSTRING(COLUMNS_UPDATED(),3,1) & 7) > 0) AND
EXISTS(SELECT * FROM [2nd table] WHERE ...)
RAISERROR ('Record is...
September 21, 2006 at 9:02 am
or
DATENAME(month,DATEADD(month,[monthcolumn],-1))
September 21, 2006 at 7:48 am
Are you looking for SQL Server solution?
Translate Access to TSQL first
SELECT @YearInput AS [input],
s.Department,
s.DateAwarded,
s.StudentNumber,
p.Forenames AS fore,
p.Surname AS Sur,
s.Mode,...
September 19, 2006 at 7:53 am
DECLARE @months int
SET @months = DATEDIFF(month,@firstdate,@seconddate)
SELECT @months % 12 AS [Months],@months / 12 AS [Years]
Some more detail and example data and results would be helpful
September 19, 2006 at 6:37 am
You can use
SELECT * FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;Database=C:\temp\book1.xls', [sheet1$])
and use dynamic sql to substitute the workbook name
but beware that when SQL reads Excel files is uses the first few...
September 18, 2006 at 7:01 am
Viewing 15 posts - 1,756 through 1,770 (of 3,543 total)