all groups > sql server programming > august 2007 > threads for friday august 24
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
is it faster to drop & create table or delete from instead
Posted by Coaster at 8/24/2007 9:35:04 PM
I have a temp table, not a real temp table but a real table that I use as a
staging area for some calculations. I actually have 3 of them. During the
calculations the temp table is loaded with up to 1 million records. The
million records are deleted during iterations of the entire process. I'v... more >>
Query/Insert quoted values in the table
Posted by research_stuff at 8/24/2007 7:14:59 PM
Hi,
I need to insert a value into a table with single quotes around it.
For example: '2581'
The '2581' would appear in the table as shown. Is there a way of
doing this in an insert statement?
Also, when a qouted value in the table, 'PRGM', and a query is
performed against the table a... more >>
Subqueries and Aggregate Functions
Posted by Paul at 8/24/2007 6:32:42 PM
Hello All,
I am having trouble coming up with the correct SQL to accomplish a
task. Most of the SQL I use is quite simple and I rarely have to
resort to subqueries so I don't have a lot of experience with them.
The following SQL gives me the result set that I want.
SELECT
ent... more >>
DBCC SHOWCONTIG
Posted by Jay at 8/24/2007 4:48:33 PM
Cross-posted in: microsoft.public.sqlserver.programming &
microsoft.public.sqlserver.server
I have a procedure that loops through the databases and then their tables
and I then want to run DBCC SHOWCONTIG on each table. However, it seems that
DBCC SHOWCONTIG is insisting on only running in ... more >>
Passing GetDate() to SP
Posted by Robert Morley at 8/24/2007 3:56:07 PM
Okay, I've got a stored procedure with a datetime parameter. Is there some
reason that I can't do
EXEC MyProc GETDATE()
It keeps giving me an error. It works fine with a fixed string, however.
Is it because GETDATE() is non-deterministic?
Thanks,
Rob
... more >>
Updating inserted row in Insert trigger
Posted by prefersgolfing at 8/24/2007 3:48:11 PM
Can you update the inserted row from within the insert trigger?
... more >>
trace file creation
Posted by ChrisB at 8/24/2007 3:26:24 PM
Hello,
I am using Sql Server 2000 Profiler to create a trace file that will be
processed by the Index Tuning Wizard. When creating the trace file, I am
using the SqlProfilerTuning template.
I noticed that, as Profiler captures database activity, multiple trace files
are created. What i... more >>
Help building SQL for Stored Proc
Posted by Bill Schanks at 8/24/2007 2:58:27 PM
I have this code in a stored procedure. It works but I would like to
have one SQL Statement rather than the IF Statements making different
INSERTS.
The only thing different with each INSERT Statement is the WHERE
Clause.
Any ideas??
<<Snip>>
--@SmallDiff is a parameter
Set @SmallDiff... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Let's Unite Against Jews and Mongrels!
Posted by Nenad Milicevic - The Aryan Serb at 8/24/2007 2:50:31 PM
Rise up and shine, white sons and daughters
Rise up and shine, you gotta fight to part those waters
When we swim in the light, all will be okay
The black, yellow and brown man will wash away.
------------------------------
Let's break the chains of Jewish and black domination! Unite, white
bro... more >>
Problems with Stored Procedure and Date
Posted by Jerry at 8/24/2007 2:42:28 PM
I apologize if this is a double post. I tried earlier and it didn't
appear to post.
I'm passing data to a stored procedure in SQL Server 2000 and am
having trouble with the date parameters. If I pass a date it works. If
I don't pass any data I get the following error:
ADODB.Command error '800... more >>
SQL Joins
Posted by Max at 8/24/2007 2:25:14 PM
Hello,
Are the following two queries equivalent in terms of performance?
1)
SELECT a.data, b.data
FROM a,b
WHERE a.key=b.key
2)
SELECT a.data, b.data
FROM a inner join b ON a.key=b.key
Thanks,
Max.
... more >>
How can you tell what SP is installed on a SQL server 2005 ?
Posted by sasachi sachi sachi at 8/24/2007 1:56:00 PM
How can you tell what SP is installed on a SQL server 2005 ? I am
looking for the SP on SQL server not SP on operating system.
Thanks in Advance,
*** Sent via Developersdex http://www.developersdex.com ***... more >>
AddAttachment method with SP_OAMethod doesn't work on SQL Server 2005
Posted by sasachi sachi sachi at 8/24/2007 1:53:06 PM
Hi,
I am trying to send an email with attachment using SQL Server 2005... i
can get the email but there is no attachment... please help... below is
the code. thanks.
*** The same works very well in SQL server 2000 ***
CREATE Procedure util_SMTPMail
@SenderAddress varchar(100),
@Recipi... more >>
loop through all table names in all db's
Posted by Jay at 8/24/2007 1:48:04 PM
I need to loop through all table names in all db's, but I can't get it to
work.
Pseudo code:
Fetch dbname into @db
while (@db) (
Fetch table names in @db..sysobjects into @table
while (@table) (
Fetch table names in @db..sysobjects into @table
print @db + '.' + @... more >>
group by ranges
Posted by John Grandy at 8/24/2007 1:36:37 PM
How do you group by ranges ?
In other words
group by Order.TypeEnumId in [1-3],[4-6],[7-9]
( Obviously the above is wrong; I'm just trying to describe what I want. )
... more >>
How to avoid Subquery returns more than one row error
Posted by mitra at 8/24/2007 1:14:11 PM
Hi All,
Please advise how to modify the sql query below to avoid getting
"subquery returns more than one row" error.
I have realized that the problem is with one of the table in the subqueries,
T_Header, table having duplicate values in the 'nHeaderValueID' column when
there shouldn't be an... more >>
Adding a row counter to a select statement.
Posted by Mufasa at 8/24/2007 12:56:00 PM
I have a select statement that does some grouping. I'd like to have it so
that the final result has a record identified that is just the record #.
So my results would be something like:
ID Group1 Group2 Value
1 A A 25
2 B B 56
3 C C 3
Any... more >>
Alter User Defined Datatype
Posted by Niben at 8/24/2007 12:30:01 PM
Hello All -
I have a SQL Server 2005 User Defined Datatype called MasterID created as
follows:
CREATE TYPE [dbo].[MasterID] FROM [int] NOT NULL
I will exclusively use this MasterID in most of the PKs in tables in my
database. The idea is when I need bigger size then switch to bigint by ... more >>
XML Query Question
Posted by Mark at 8/24/2007 11:06:27 AM
Thanks in Advance.
I am current on a MS SQL Server 2000 Standard version. How do I write
a query that retrieves custcode from an XML file with the following
format?
<?xml version="1.0" encoding="UTF-8"?>
<!--file generated by MEI-->
<document name="syxSAAC_BO">
<tables> <SAAC_I... more >>
Storing the output of DBCC CHECKDB
Posted by Jay at 8/24/2007 10:53:34 AM
I need to either store the output of CHECKDB in a data structure, or capture
the @@ERROR without the error aborting the script.
When I force an error (by adding a character to the db name), the script
immediatly aborts.
Though the insert to temp works, there are no results.
My current c... more >>
How to designate "Intentionally Left Blank" values?
Posted by Dursun at 8/24/2007 10:38:01 AM
SQL Server Gurus,
I was wondering what would be the BEST and most efficient way to designate a
value for a filed (which is not required to be filled in) that indicates
"Intentionally Left Blank" as opposed to accidentally not filled out. Is
there any sophisticated mechanism that SWL Server ... more >>
generate random number for each row
Posted by weileogao NO[at]SPAM gmail.com at 8/24/2007 9:18:53 AM
Hi,
I try to generate a random number for each row using "select *,rand()
into foo from bar". But same number will be generated. And alsoI try
to use rand(id), but the point is for the same id the genearated
number will be same. Question is except the cursor and DTS ways is
there any other S... more >>
Permissions issue
Posted by Farhan Iqbal at 8/24/2007 8:08:01 AM
hi,
I have created one SQL User and give the select rights on some views, but
this user has the public role rights as well that’s why user can access
system objects. Now I want to prevent the user that the user could not see
the system objects, please tell me how this is possible.
Than... more >>
Re: Fixed Database Role
Posted by Farhan Iqbal at 8/24/2007 7:52:02 AM
thank you for your reply,
I have only 20 days trace log backup is there onother why to find out this.
and one more thing default trace log files over ride after certain period so
is there any why to maintain these default trace log to specified time of
period and how ?
Regards,
Farhan
... more >>
Database specific TRAN
Posted by gambool at 8/24/2007 2:30:46 AM
Hi,
Scenario:
Server with multiple databases. Each database has stored procedures
that during runtime, log various activities to a seperate database
(ProcessLog) at various points throughout the procedure. When I use a
transaction within a stored procedure, and the tran is rolled back,
e... more >>
Data types conversions, nvarchar --> numeric, nvarchar --> date
Posted by natalymolyneux NO[at]SPAM gmail.com at 8/24/2007 1:18:33 AM
Hi everybody :-)
After importing data from a flat file I am tring to convert fields
datatypes. Most problematic for now seems to convert nvarchar to
numeric and nvarchar to different kinds of date data types. I have
tried a gradual conversion:
nvarchar --> char --> numeric or nvavarchar --> v... more >>
Problems of Latitude and Longitude
Posted by ankurpat NO[at]SPAM gmail.com at 8/24/2007 12:19:56 AM
Hi
i have one table Hotel
Field: hotelId,hotelName,locationId,latitude,longitude, etc
I got the location geo point(latitude,longitude) from using goole api
location Name: Delhi
Latitude = 28.6137,
Longitude = 77.1834
now Is it possible to get the proper result of hotel to fire ... more >>
question about data optimization
Posted by santiago at 8/24/2007 12:00:00 AM
it is said that the database systems are fast for retrieving or
storing data and not as fast in processing data.
whereas languages like C# or VB.NET are fast for processing data.
i want to know how much should we follow this rule.
... more >>
Whats Wrong With This CASE Statement ?
Posted by New Bee at 8/24/2007 12:00:00 AM
This tells me I have an incorrect syntax near CASE and END. I am using this
in a stored procedure
CASE WHEN @IsHoldingProject=0 THEN
INSERT @returnTable select * from Personell
END
Thanks in advance !
... more >>
Can Someon Help Me Please
Posted by New Bee at 8/24/2007 12:00:00 AM
I am using SQL server 2000. There is no IF statement.
The construct I am looking for is "Something Like" this.
IF MyCondition=0 THEN
INSERT @returnTable Select ,. , , , , , , , ,,
Else IF MyCondition = 1 THEN
. . . .
END
I have tried to use CASE, but cant get it to work o... more >>
LEFT function uses table scan?
Posted by Leila at 8/24/2007 12:00:00 AM
Hi,
I use LEFT function in where clause on a column that has nonclustered
covering index. The query optimizer uses table scan, while without LEFT it
performs index seek.
Is it normal?
Thanks in advance,
Leila
... more >>
accidental deletion of record with in dentity column
Posted by luna at 8/24/2007 12:00:00 AM
i've deleted a record from a table with an identity column, how can i easily
replace it with minimal fuss ?
its just 3 fields
cheers
mark
... more >>
Being aware of table data changes from external application
Posted by Kürþat at 8/24/2007 12:00:00 AM
[MS SQL Server 2005]
Hi,
Is it possible to sense changes to a table from an external application
without polling? Is there any interprocess signaling or callback mechanism
to use with MS SQL Server 2005?
Thanks in advance.
... more >>
|