Hey,
I need some help ;)
I got an Object object1 of the Type (id, ob1 REF object2, ob2 REF object2).
These objects2 Types already exists, and I have to create a new object1 with references to the two differen object2 things.
What I am trying right now:
DECLARE
t_ref REF object2;
t_ref2 REF object2;
BEGIN
SELECT REF(*) INTO t_r...
Does performance of a database (SQL Server 2005) decrease if I shrink it?
What exactly happen to the mdf and ldf files when shrink is applied (Internals???)
...
I have the table of following structure:
UserID StartedOn EndedOn
1 2009-7-12T14:01 2009-7-12T15:01
2 2009-7-12T14:30 2009-7-12T14:45
3 2009-7-12T14:47 2009-7-12T15:30
4 2009-7-12T13:01 2009-7-12T17:01
5 2009-7-12T14:15 2009-7-12T18:01
6 2009-7-12T11:01 2009-7-12T19...
HiIs it possible to write SQL query that returns table rows in random order every time the query run?
...
I don't get it? I don't see any place to perform an "Union All" in the syntax. What am I missing?
CREATE PROCEDURE SapUser_NdaysBeforeExpirationNotification
-- Add the parameters for the stored procedure here
(
@AuditTypeKey nvarchar(50),
@TimeLapseInMonths int
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result s...
In T-SQL what's faster?
DELETE * FROM ... WHERE A IN (x,y,z)
Or
DELETE * FROM ... WHERE A = x OR A = y OR A = z
In my case x, y and z are input parameters for the stored procedure. And I'm trying to get the performance of my DELETE and INSERT statements to the best of my abilities.
...
Dear Friends
i m using the following which Execute against 1'500'000 rows
My SP is as follows:
CREATE Procedure USP_12(@AuditMasterID as varchar(10),@TABLE as Varchar(50))
as
BEGIN
Declare @SQLStatement varchar(2000)
Declare @PrefixNo varchar(20)
Declare @PrefixLen varchar(20)
Declare @AfterPrefixLen varchar(20)
DECLARE Cur_Prefix CUR...
I have a MSSQL 2000 server with a table containing an image field. How do I insert the binary data of a file into that field by specifying the path of the file?
CREATE TABLE Files
(
FileId int,
FileData image
)
...
I have the next query that I run via SQLCMD.EXE
use [AxDWH_Central_Reporting]
GO
EXEC sp_spaceused @updateusage = N'TRUE'
GO
That return 2 tables... and uglu output file with the next conent:
Changed database context to 'AxDWH_Central_Reporting'.
database_name ...
I have the next query for MSSQL that will return the amount of free space on a database. Is there any analog for OLAP cube-types DBs?
use [AxDWH_Central_Reporting]
GO
EXEC sp_spaceused @updateusage = N'TRUE'
GO
...
I have to work in a DTS environment in 2005 (too complicated to explain) and I have a comma delimited text file that is to be appended to the main table. I'd like to pull the last column in the text file out for the first record and use it as select criteria for a delete command. But how can I do this in the older DTS environment?
Her...
Hi,
I have inherited an application that logs the results of certain daily commands that run on multiple hosts to an MS-SQL table. Now I've been asked to provide a view/query that displays the last log line per host to get an overview of the last results.
The table is similar to this:
------------------------------
|HOST |LAST_RUN ...
[using SQL Server 2005]
I have a table full of users, I want to assign every single user in the table (16,000+) to a course by creating a new entry in the assignment table as well as a new entry in the course tracking table so their data can be tracked. The problem is I do no know how to do a loop in SQL because I don't think you can bu...
Hi,
I have a Query that's supposed to run like this -
If(var = xyz)
SELECT col1, col2
ELSE IF(var = zyx)
SELECT col2, col3
ELSE
SELECT col7,col8
FROM
.
.
.
How do I achieve this in T-SQL without writing separate queries for each clause? Currently I'm running it as
IF (var = xyz) {
Query1
}
ELSE IF (var = zyx) {
...
I know the syntax:
ALTER TABLE [TheTable] DROP CONSTRAINT [TheDefaultConstraint]
but how to I drop the default constraint when I don't know its name? (That is, it was autogenerated at CREATE TABLE time.)
...
Hi
I have a variable of DateTime type in SQL.
Just need to have Date part of it.
please Help?
...
I did batch to run SQL query like
use [AxDWH_Central_Reporting]
GO
EXEC sp_spaceused @updateusage = N'TRUE'
GO
It displays 2 tables and generates some ugly report with some kind of 'P' unneeded letters... See below
Changed database context to 'AxDWH_Central_Reporting'.
database_name ...
Hi,
I have one table as Follows
ID bigint
TaskName nvarchar(50)
StartDate datetime -- Start date of task
EndDate datetime -- End Date Of Task
I am trying to Write One Procedure Which Takes Two inputs @FromDate and @EndDate
as datetime, To get list of TaskNames Which are in process between input parameters.
Can an...
I have some code that disables a trigger on a table, runs an update, and reenables the trigger. It doesn't drop the source table or update the schema.
This would all be fine, but at the same time there are separate queries running that use that table as the source for a SELECT INTO. For some reason, when the two queries are running at t...
I have a statement that SELECTs distinct rows from a table with a two value index
SELECT distinct Reference, Value1, Value2, Value3, Value4 FROM [tblHistory]
Where Reference is an index with another field "Project". For a particular system this data is inserted into another table using only Reference as the index because Value1 throug...