Viewing 15 posts - 2,401 through 2,415 (of 6,036 total)
DECLARE statement is not executeable at run time.
It just reserves memory needed for variables (including table variables).
Memory allocation happens when a script is being parsed and compiled.
That's why no matter...
January 10, 2010 at 3:15 pm
INSERT INTO dbo.wind0
(datetime, maxspeeddeg )
SELECT T.item, Cast(S.item as decimal(4,1))
FROM dbo.GA T
CROSS JOIN dbo.GA S
WHERE (T.timeframe = 'actual' and T.sensor = 'date0' and T.cat = 'date' and T.unit = 'utc')
AND...
January 10, 2010 at 4:15 am
Look not for continuous spans, looks for breaks longer than 1 day.
The end of the latest of such breaks will be the beginning of the latest continuous span.
December 29, 2009 at 7:18 pm
By using or not using "N" you define the datatype of the string you supply to the parameter of the procedure.
If "N" is missing then you supply non-unicode string and...
December 20, 2009 at 5:31 pm
Another approach.
Seems simpler to me.
Step 1... make sure the code works as is.
Step 2... wrap the code into stored procedure
Step 3... make the query like this: 'EXEC dbo.StoredProcedure' [+ parameters]
December 10, 2009 at 4:40 am
Compare TABLE_NAME to UPPER(TABLE_NAME) using a case sensitive collation.
Check what is your database default collation and choose similar one, but case sensitive.
It should be going like this:
select * from information_schema.tables
WHERE...
December 6, 2009 at 4:59 pm
BEGIN
select 'alter table ' + QUOTENAME(sysusers.name) + '.' + QUOTENAME(tables.name)
Just in case...
December 2, 2009 at 1:34 am
Jeff, a small correction.
It should be:
...
join sysdba.history h on h.accountid = maxdate.accountid AND h.startdate = maxdate.MaxStartDate
...
🙂
November 25, 2009 at 8:12 pm
DECLARE @Codes TABLE(
Code binary(1) PRIMARY KEY
)
INSERT INTO @Codes (Code)
SELECT CONVERT(binary(1), number)
FROM master.dbo.spt_values
WHERE Type = 'P'
AND (number between 65 and 90 OR CHAR(number) LIKE '[0-9]')
SELECT
T1.Code + T2.Code + T3.Code...
November 24, 2009 at 4:07 pm
Schema evaluation happens during parsing time, not execution time (just like in any other programming language).
So, there is nothing stange in this behaviour.
P.S. Altering table schema on fly is one...
November 17, 2009 at 5:32 am
bjvaishnani (11/11/2009)
DECLARE @WhereQueryNVARCHAR(MAX)
SET @WhereQuery = ' WHERE COND1 and cond2'
SET @SelectQuery = ' SELECT Col1, col2,, From Table1 ' + @WhereQuery
SET @CountSQLQuery = N'SELECT COUNT(*)
FROM
dbo.Table1 ' +...
November 16, 2009 at 4:25 pm
Since you don't have any WHERE clause you're pretty much doomed to scan whole table every time the report is called.
All the millions of rows.
If your requirement is to get...
November 15, 2009 at 1:35 pm
You may join inserted and deleted tables by primary/unique key to the base table and grab text values from there.
Insert into Meet_Master_Log (ActionTaken, Meeting, Title,Description,LogDate,LogBy)
Select
Case
When inserted.Meeting is null then 'D'
When...
November 15, 2009 at 2:29 am
Index on eventDuedate should be clustered.
November 11, 2009 at 5:01 pm
You may get rid of dynamic SQL problems by converting "Excel-style" tables to more appropritate form:
CREATE VIEW dbo.tPosiDtl_2009
-- view which contains all records for the whole year
AS
select TID,...
November 9, 2009 at 9:57 pm
Viewing 15 posts - 2,401 through 2,415 (of 6,036 total)