Viewing 15 posts - 1 through 15 (of 24 total)
ALZDBA is correct, both temp tables and tables variables needs to be stored in tempdb under some circumstances. However, there are some differences in relation to performance to when it...
February 23, 2011 at 3:30 pm
Your best bet would probably be to make the user dbo, however it depends on the permission requirements of your particular db.
If you would like to grant the permissions explicitly...
February 23, 2011 at 2:51 pm
The querey itself should work on 2008 as well. This may be a longshot, but have you checked the collation of your 2008-db so it's not case sensitive?
February 21, 2011 at 8:50 am
Hi,
No the actual DELETE-syntax is incorrect, furthermore you cannot pass object names (DBs, tables, etc.) as variables like that without using dynamic SQL.
Try something as below:
Declare
@db_name nvarchar(50)
DECLARE db_cursor CURSOR FOR...
February 16, 2011 at 3:55 pm
WHERE [DATE] >= DATEADD(HOUR, - 1, GETDATE())
February 16, 2011 at 3:32 pm
Hi David,
Wouldn't describe it as a real issue, but obviously you would have to use COLLATE when joining string data in temp tables with string data in user DBs.
February 16, 2011 at 2:45 pm
No problems.
I don't know exactly what your planned usage is, however if you'd like to be protected against SQL injection you should consider using sp_executesql instead of EXECUTE.
February 16, 2011 at 2:39 pm
Hi,
The error occurs because you're trying to use object names (tables, columns, etc.) in variables. In order to achieve what you want you need to use dynamic SQL.
See the example...
February 15, 2011 at 5:59 am
Hi ann, check books online for TRY...CATCH.
November 12, 2010 at 12:32 pm
For the query itself you might want to try something like
DECLARE @TotalNumberOfUnits INT
SELECT @TotalNumberOfUnits = COUNT(*) FROM Temp WHERE GUID=@GUID
DECLARE @Res TABLE
(
Results SMALLINT PRIMARY KEY CLUSTERED,
NumOcc INT
)
INSERT @Res
(
Results,
NumOcc
)
SELECT
Results,
COUNT(*)
FROM...
November 10, 2010 at 12:27 pm
Hi there,
I agree with Craig, the test data doesn't make sense.
I'm assuming that submenuid corresponds to menuid and then the query would look something like below.
-- Create testdata
DECLARE @MasterTable TABLE...
November 7, 2010 at 2:25 pm
Hi there,
Create the function below, and then call it like SELECT * FROM F_ConvertStringToTable('1 Adam Rim Jessica Joel)', ' '):
CREATE FUNCTION F_ConvertStringToTable
(
@List VARCHAR(MAX),-- Separerad lista av värden
@Delimiter CHAR(1)-- Avgränsare/separator
) ...
November 2, 2010 at 1:04 am
Or a CTE like below:
;WITH CUSTADDR
AS
(
SELECT
CUSTOMER_ID,
ZIPCODE,
ADDR,
ROW_NUMBER() OVER(PARTITION BY CUSTOMER_ID, ZIPCODE ORDER BY SHIPPING_DATE DESC) AS RowNr
FROM CUSTOMERADDRESS -- Your table
)
SELECT
CUSTOMER_ID,
ZIPCODE,
ADDR
FROM CUSTADDR
WHERE RowNr = 1
November 1, 2010 at 3:58 pm
The information on how to join the tables (on what values/columns) is still missing. Joining on the ADDR column, which would be my guess to would give no matches, so...
October 31, 2010 at 3:58 pm
Viewing 15 posts - 1 through 15 (of 24 total)