Viewing 15 posts - 6,376 through 6,390 (of 7,608 total)
You don't need a cursor at all, just an UPDATE followed by an INSERT (or MERGE, but some people have run into performance issues with MERGE).
The table names aren't consistent,...
September 16, 2013 at 10:44 am
SELECT
OBJECT_NAME(object_id) AS table_name
FROM sys.columns
WHERE
name IN ( 'col1', 'col2', 'col3' ) AND
OBJECTPROPERTYEX (object_id, 'BaseType') IN ( 'U', 'V' )
GROUP...
September 16, 2013 at 10:03 am
I suggest this method:
DECLARE @date datetime
--@date is used just to make it easier to check other dates:
-- naturally you can hard-code GETDATE() in place of @date if...
September 13, 2013 at 2:06 pm
Sean Lange (9/13/2013)
September 13, 2013 at 1:56 pm
4 tables of between 1M and 2M rows shouldn't take much time to run, except on a very limited server.
There must be something in the query that is causing some...
September 13, 2013 at 1:54 pm
Some points to consider:
Be sure to make the search value a character string, viz:
SET @MySearchCriteria = '''3496'''
"Max_length" is bytes, which works fine for (n)(var)char, but not so much for int,...
September 13, 2013 at 1:52 pm
A trigger is the best way to handle that.
September 13, 2013 at 1:43 pm
In a D/R situation, it might be a royal pita to have only AD accounts to have access to the instance.
I'd rather be able, in a genuine emergency, to bring...
September 12, 2013 at 10:32 am
WHERE
Docket_Date >= DATEADD(MONTH, DATEDIFF(MONTH, 0, @date1), 0) AND
Docket_Date < DATEADD(MONTH, DATEDIFF(MONTH, 0, @date1) + 1, 0)
September 11, 2013 at 2:04 pm
I would never allow the sa password to be the same on more than one instance. The sa account is to be used only in an emergency anyway (such...
September 11, 2013 at 2:01 pm
No, it's not a good idea. SQL will typically not be able to generate as good a plan for remote tables as it does for local ones.
September 10, 2013 at 2:41 pm
You can get the result you need: the specific method depends on specifically what you need to do. If you can provide sample values and the desired results, we...
September 9, 2013 at 7:24 am
For anything less than 24 hours, you can do this:
SELECT
CONVERT(varchar(8), DATEADD(SECOND, DATEDIFF(SECOND, segstart, segstop), 0), 8)
FROM (
SELECT CAST('20130906 09:28:00' AS datetime) AS...
September 6, 2013 at 3:49 pm
Just list the column names that are being inserted into the new table; you don't have to supply all columns. For example, see below; naturally your specific column names...
September 6, 2013 at 3:26 pm
SELECT *
FROM dbo.tablename
WHERE Customer IN (
SELECT Customer
FROM dbo.tablename
GROUP BY Customer
HAVING COUNT(DISTINCT Contract) > 1
...
September 6, 2013 at 3:22 pm
Viewing 15 posts - 6,376 through 6,390 (of 7,608 total)