Viewing 15 posts - 1,036 through 1,050 (of 2,007 total)
adrian.facio (1/17/2012)
I sometimes like to construct the code to execute the procedures with a script like the following, it has been very useful to me lot of times, but it...
January 18, 2012 at 5:29 am
DECLARE @TblName varchar(50)
DECLARE @ColValue int
set @ColValue=30
set @tblName='MyTable'
execute sp_executesql N'Select * from '+ QUOTENAME(@tblName) + ' where somecol = @ColVal' , '@ColVal int', @ColValue;
January 17, 2012 at 11:10 am
.Netter (1/17/2012)
"Msg 457, Level 16, State 1, Line 1
Implicit conversion of varchar value to varchar cannot be performed because the collation of the value is...
January 17, 2012 at 7:04 am
DDL and sample data would be very useful, click this link to see how best to lay it out. Help us to help you![/url] 😀
Off the bat, your UNION...
January 17, 2012 at 6:42 am
Rayven (1/17/2012)
Grief, were you sitting on the forum!!! That was an incredibly fast response - thanks! :w00t:
Just lucky 😀
As I said, if you're using 2008 then you can get similar...
January 17, 2012 at 4:59 am
Gail wrote a blog on the issue you're describing[/url].
Dynamic is the best way to go (or RECOMPILE) - and more vigorous testing! 😛
January 17, 2012 at 4:45 am
SQL Kiwi (1/17/2012)
mic.con87 (1/16/2012)
please can you explain the CROSS APPLY...
See:
http://www.sqlservercentral.com/articles/APPLY/69953/
http://www.sqlservercentral.com/articles/APPLY/69954/
LEN
http://msdn.microsoft.com/en-us/library/ms190329.aspx
...and also why you used a CAST and not a CONVERT.
I tend to prefer CONVERT because it supports explicit styles. ...
January 17, 2012 at 2:07 am
guerillaunit (1/16/2012)
Cadavre,Is the code you posted the daily job scheduling?
Yes. You'd need to go through and change the job name, the table names, schema names and database names. Also, it's...
January 16, 2012 at 8:46 am
mic.con87 (1/16/2012)
January 16, 2012 at 8:42 am
The most likely issue is that the data has been entered in multiple formats, e.g. DDMMYYYY and MMDDYYYY
This makes the whole task harder because you can't know which way you...
January 16, 2012 at 8:06 am
Bit of a stab in the dark: -
USE [msdb]
IF EXISTS (
SELECT job_id
FROM msdb.dbo.sysjobs_view
WHERE name = N'YourJobName'
)
BEGIN
EXEC msdb.dbo.sp_delete_job @job_name = N'YourJobName',
@delete_unused_schedule = 1
END
DECLARE @jobId BINARY (16)
EXEC msdb.dbo.sp_add_job @job_name = N'YourJobName',
@enabled =...
January 16, 2012 at 8:01 am
BEGIN TRAN
CREATE TABLE #Dates (CurrentDateFormat int, IncidentDate Date )
INSERT INTO #Dates VALUES (0,'1900-01-01') --All 0's to default to '1900-01-01'
INSERT INTO #Dates VALUES (14041979,'1979-04-14')
INSERT INTO #Dates VALUES (04021983,'1983-02-04')
INSERT INTO #Dates VALUES...
January 16, 2012 at 7:38 am
Apologies, I didn't read the whole thread when I replied.
BEGIN TRANSACTION
CREATE TABLE mytable (id INT identity(1, 1),PersonID INT,Unit VARCHAR(10))
INSERT INTO mytable VALUES (1,'Che')
INSERT INTO mytable VALUES (1,'Mat')
INSERT INTO mytable VALUES...
January 16, 2012 at 5:16 am
SQL Kiwi (1/16/2012)
Jeff Moden (1/16/2012)
January 16, 2012 at 5:10 am
Your issue is probably due to your index.
Try this replication script: -
BEGIN TRAN
SET NOCOUNT ON
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
DROP TABLE #testEnvironment
END
--1,000,000 Random rows of data
;WITH CTE AS (
SELECT DATEADD(HOUR,ROW_NUMBER() OVER...
January 16, 2012 at 5:01 am
Viewing 15 posts - 1,036 through 1,050 (of 2,007 total)