all groups > sql server programming > january 2005 > threads for tuesday january 11
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
Sorting by performance difference - int vs. varchar
Posted by Anders at 1/11/2005 11:57:28 PM
Hi, do any of you know what difference there is in performance between
sorting rows by a int column versus a varchar(4) column ?
Thanks for any reply,
Anders
... more >>
Convert TIMESTAMP to GMT?
Posted by clintonG at 1/11/2005 7:08:50 PM
My application will write XML to the database and I'm wondering if it is
feasible to use a SQL2000 TIMESTAMP to record the lastBuildDate that
indicates when an RSS channel was last edited. The RSS specifications [1]
however require lastBuildDate to be formatted as: Sat, 07 Sep 2002 09:42:31
GMT... more >>
Comparing Strings and Case-sensitivity
Posted by Amelia at 1/11/2005 7:07:03 PM
By default, SQL Server does case insensitive comparisons
eg - Select Name1 from Names where Name1 = 'Fred'
will return
'FRED'
'fred'
'Fred' etc...
I have tried to find the Database setting for this or more information with
no luck.
Any help much appreciated. Thanks... more >>
Alternative to nullif
Posted by shop NO[at]SPAM pacifictabla.com at 1/11/2005 6:52:59 PM
Hi:
I'm using the following code to set Corp_AvgTalkTime to null if there
is a division by zero (see nullif below). I might want to set it to
zero, or in some cases I might want to replace it with '00:00:00'.
Right now I go back over the data and set it using another update, but
I would like ... more >>
DTS Import Package
Posted by DavidM at 1/11/2005 6:35:12 PM
Hello, all.
I'm new to DTS and am currently working on a project to import two CSV files
into the same table.
Basically, the challenge that I'm having is that each record of the file
contains more than one item that needs to be inserted as its own row.
For example,
FILE1:
DATE field... more >>
update 2 fields problem
Posted by Agnes at 1/11/2005 5:54:31 PM
I can update 1fields (acctcode, however I want to update 2 fields, Can I use
one query to do ?)
update arinvchg set acctcode =
(select CBA.revimcode
From DTS_MASTER.dbo.chgbranchacct CBA ,DTS_Account.dbo.arinvinfo AI
where AI.validsw =1 and AI.postsw = 0 and AI.invno = Arinvchg.invno a... more >>
TRICKY SQL
Posted by MS User at 1/11/2005 5:29:12 PM
SQL 2K
I got a table by name 'CarMovement' and we have 5 different moves (A, B, C,
D, E).
'A' is the starting move and 'E' is the ending move.
Here is my table schema
CarNum
MoveType
MoveDate
I need to return cars, based on my date search criteria (StartDate, EndDate)
Step 1:- If... more >>
MS Access
Posted by scorpion53061 at 1/11/2005 5:12:53 PM
Is it possible after exporting to MS Access from a SQL table to instruct
the Access database to compact itself?
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Create New Table From Other tables
Posted by scorpion53061 at 1/11/2005 5:08:11 PM
UP to this point, I would execute this statement in query analyzer and
copy the results pane and paste into a text document. Then I would
import into excel and do cleanup. I would like to streamline if I could.
This is the statement:
select distinct PRODUCTGROUP, STOCK.number AS ITEMNO, st... more >>
Monitor Query's that come through SQL 2000
Posted by Chris, Master of All Things Insignificant at 1/11/2005 4:33:47 PM
I need to know if there is a way to log all the queries that get sent to my
server. I have some queries that may be dogging my system but I don't have
access to the exact query. I'm new to SQL 2000 so if it is simple, that is
why. Thanks
Chris
... more >>
Get the number of rows in the tables ?
Posted by Chris V. at 1/11/2005 4:07:57 PM
Hi,
I'm looking for a "smart" way of getting the number of rows contained in
each user tabel of a given database.
I've begun to use a script executing a SELECT COUNT(*) FROM @Table, but it
will obsiouvly be extremly painful for the perf.
I'm almost sure that SQL will have smartest embedde... more >>
Delete trigger doesn't delete
Posted by Dawn Coelin at 1/11/2005 3:46:04 PM
Hi, all!
I'm trying to create a trigger that will delete other records in the same
table when one is deleted. The others to be deleted are child records to the
delete record (discussion board style). I have the fields and criteria setup
correctly so much so that it works in Query Analyzer f... more >>
.NET runtime host in SQL 2005: user defined types question
Posted by TR at 1/11/2005 3:44:30 PM
Regarding the upcoming version of SQL Server, with support for the .NET
runtime -- will it be possible to pass user-defined objects from client
programs, via ADO.NET, to stored procs?
Thanks
TR
... more >>
Can I do this? - Bulk Insert
Posted by Jorge Luzarraga Castro at 1/11/2005 3:21:59 PM
Hello,
I need to insert the content from a text file into a database table.
According to the BOL I must use the 'Bulk Insert', the issue raises ´cause I
must execute this everyday, and the name of the file changes, theres is a
part of the name that contains the date of creation. So I´d hav... more >>
Permissions question...
Posted by Brett Davis at 1/11/2005 3:20:34 PM
Hello...
I have a role in a SQL Server 2000 database called "Power Developer", within
this role I want to allow the developer the ability to change stored
procedures but not table schema. I have looked at the ddl_admin database
role but that looks like that will give the developer the abil... more >>
Index Performance
Posted by Mike Labosh at 1/11/2005 2:52:05 PM
Phrasing like this will be used to match product names from a data file to
product identity keys in the database. SampleSourceArchive is where the raw
file data is bulk inserted. AlternateHardwareProduct contains a list of all
the variations of product names, mapped to ProductKeys. So I concat... more >>
WHERE if two counts are 0?
Posted by Dennis Burgess at 1/11/2005 2:38:57 PM
I have the following statement. The first two sums calculate the current
and previous month to date numbers. What i want is it NOT to display any
lines that these two numbers are zero?
Any ideas?
SELECT salesrep,
Sum(case when (sold_dt >= '::mt::/01/::yr::') AND (sold_dt <
DATEA... more >>
OPTIMIZER LOCK HINTS
Posted by Sa at 1/11/2005 2:15:16 PM
Hello,
I am writing a Stored Procedure. In the middle of the stored procedure, I
have the following code:
:
:
BEGIN TRAN dataMigration
-- Insert records to the destination table
INSERT ACCOUNT
WITH (ACCOUNTID, ACCOUNT, MAINPHONE, FAX)
VALUES (SELECT ACCOUNTID, ACCOUNT, MAINPHONE... more >>
Copy entire sql server
Posted by Bob at 1/11/2005 2:14:15 PM
Hi,
What is the best way to COMPLETELY duplicate a SQL 2000 server? Im
thinking:
1: detach all the dbs
2: copy all dbs to new server
3: somehow copy logins and jobs etc over (how?)
if i can copy users over and they are in a domain, will i have any SID
problems?
Thanks..
*** Sen... more >>
sort
Posted by ls_y041 at 1/11/2005 2:07:06 PM
1+A+1 1+A+2 1+A+1
1+A+3 1+A+2
1+A+4 1+A+3
1+B+1 1+A+4
1+B+2 1+B+1
10+A+1 1+B+2
10-B-1 2-A-1
10-B-2 2-A-2
10-B-3 2-A-3
10-B-4 2-A-4
10-C-1 2-A-5
10-C-2 3+... more >>
A correlative column inside Select
Posted by JJ_ at 1/11/2005 1:59:05 PM
May someone help me, how to create a column inside a select that show me a
correlative by sql server.
Thanks
... more >>
Age-old question - View versus Stored Procedure
Posted by MSSQLServerDeveloper at 1/11/2005 1:37:02 PM
In the case of SQL Server 2000 - Where I need to return a resultset of rows
to an application from joining multiple tables and passing a parameter for
filtering. Since stored procedures and views can basically accomplish the
same thing, I was wondering if there is a benefit of using one over ... more >>
script and indexes
Posted by Ian Oldbury at 1/11/2005 1:28:02 PM
i'm trying to add indexes and constraints by using scripts.
we don't have access to enterprise manager, but we should be able to have
access to Query Analyser so we can run a script. Could someone point me in
the direction of what to look at.
please help
... more >>
Wrong week of year
Posted by Lasse Edsvik at 1/11/2005 1:15:28 PM
Hello
I'm having some problems
I have this:
SET DATEFIRST 1
SELECT DATEPART(WW,GETDATE())
returns 3, its week 2 now if im not misstaken......
My user that i connect to has language Swedish and im not sure what else
could be wrong
TIA
/Lasse
... more >>
Help with at simple rank query.
Posted by Geir Holme at 1/11/2005 12:41:01 PM
Hi all.
I have a large orderline table. I have a given CustomerID. I want to list
the Sum(Price) for this customer AND the Rank (where in the total list this
customer is placed).
E.g
With this I can make the following sentece:
"Dear customer. You have bought for $2000 the last month. T... more >>
Functions within functions
Posted by Scott McNair at 1/11/2005 12:32:33 PM
Why can't I use items like RAND() or GETDATE() within a function? Is there
some sort of workaround to get those functions in there?... more >>
place decimal in varchar data
Posted by mamun at 1/11/2005 12:20:58 PM
Hi All,
I have a table where currency is saved as varchar.
For ex. 24629, this is actually 246.29. It always represents two
decimal places from right.
I need to run a query which will show the results in decimal format
instead of varchar format.
Here is what in the database
00002426... more >>
Disappearing Values
Posted by Scott McNair at 1/11/2005 12:08:51 PM
Hi,
For some reason the value of a variable disappears when it passes
through a loop, and I can't see why it's disappearing. A set of extra
eyes would be greatly appreciated.
The following code generates a random number (@chits) a certain number
of times (@numrolls) and stores it in @di... more >>
Return Multiple Tables to Dataset
Posted by Robert at 1/11/2005 11:43:04 AM
I need to call a stored procedure in Sql Server that will populate 2 tables
in a dataset. I am using the Microsoft Data Access Application Block. I am
simply bringing back everything from 2 small tables in the same database. My
call simply looks like this:
ds= SqlHelper.ExecuteDataset(co... more >>
Passing multiple selections to a stored proc parameter
Posted by Spencer23 at 1/11/2005 10:57:03 AM
Hi,
I am currently in the process of building a stored procedure that needs the
ability to be passed one, multiple or all fields selected from a list box to
each of the parameters of the stored procedure. I am currently using code
similar to this below to accomplish this for each parameter:... more >>
SQL Cursor
Posted by Paul at 1/11/2005 10:46:06 AM
I am new to SQL programming. I have two tables with the first table contains
over 410,000 records in 20 fields. The second table has only two fields, ID
and Keyword with 266 records on it. What I need to do is to create a nested
loop on the two tables, so that it will filter out the record on ... more >>
cannot load dll xpstar.dll reason 126
Posted by romy at 1/11/2005 10:44:08 AM
Hi
This error message happens when trying to restore/backup a database
(The file exists in the binn directory)
How do I solve it ?
thanks in advance
Romy
... more >>
LOOKUP combo box
Posted by vichet at 1/11/2005 10:07:28 AM
Hi all;
before, i use only access, not adp.
i use two combo boxes, i.e. cmb1 and cmb2;
Recordsource fo cmb2 is based on the value selected of cmb1
example:
select something from mytable where myfield=cmb1.value
but, after i change it to adp. it does not work.
i try to use storeprocedu... more >>
How to select columns dynamically
Posted by velmj at 1/11/2005 9:59:06 AM
Hi everyone,
I am creating a dynamic table in my stored procedure. Now I want to
write a query, to select columns from that table only if it doesnot have a
'null' value in any row.
Scenario:
-----------
CREATE TABLE #FINAL(
DATE DATETIME,
A VARCHAR(50),
B VARCHAR(50),
... more >>
IIF Function
Posted by vichet at 1/11/2005 8:12:23 AM
Hi all;
I try to use IIF function to test my STATUS field in select clause as
follow:
select IIF(status=1,'Active','Closed') as MyStatus from mytable
but it dose not work; tell me why?
thank;
... more >>
Value of a identity-column
Posted by KLaus at 1/11/2005 7:36:32 AM
Hi
In a table the primary key is of the Identity-datatype.
This means that the value of this field is automatically
being generated.
When inserting a new row is it then possible to obtain the
identity-value? I would like to do this so that I can used
when inserting rows in other tables... more >>
sp_attach_db
Posted by Stijn Goris at 1/11/2005 6:39:03 AM
hi all,
I want to attach a database and use sp_attach_db to do the job. I execute
EXEC sp_attach_db @dbname = N'ReferenceData',
@filename1 = N'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\RestoreReferenceData.mdf',
@filename2 = N'C:\Program Files\Microsoft SQL
Server\MSSQL\Data... more >>
CROSS JOIN
Posted by Aviad at 1/11/2005 5:59:04 AM
Hello All,
I have a SELECT statement (Lets say, SELECT Time FROM temp) that returns:
Time
---------
@# Time #@
1
2
3
@# Another Time #@
Q1
Q3
And I have another SELECT statement (Lets say, SELECT MaritalStatus FROM
temp) that returns:
MaritalStatus
----------------
@# Marita... more >>
CHARINDEX
Posted by AGB at 1/11/2005 5:58:36 AM
Hi all,
I am trying to remove apostrophes from a column in a table called
paths. I am not sure how to escape the ' character in my CHARINDEX
expression...any help?
UPDATE Paths
SET Path = STUFF(Path, 1, CHARINDEX(?, Path), '')
FROM Paths
... more >>
UNION
Posted by Aviad at 1/11/2005 1:31:03 AM
Hello,
I have a SELECT statement
(SELECT DISTINCT Products FROM Shelf
UNION
SELECT ' @#@#@#@#' AS Col1 FROM Shelf) that returns:
Products
--------
@#@#@#@#
Alcoholic Beverages
Milk
I have another SELECT statement
(SELECT DISTINCT Food FROM Shelf
UNION
SELECT ' @#@#@#@#' AS Col... more >>
Auto truncate a string to be inserted to SQL table
Posted by BTLye at 1/11/2005 1:25:03 AM
Hi SQL experts,
May I know how can I auto truncate a string to be inserted to a SQL table to
avoid from getting the error "String or binary data would be truncated."? For
instance, if sent-in data has 15 chars but the column length is only set to
10, the data will be truncated for its last ... more >>
Sql function for EAN 128
Posted by checcouno at 1/11/2005 1:01:02 AM
I need to print a query result in barcode EAN 128. Do anyone know where to
download a sql script function o sp that convert my fields in EAN 128 code?
I've got already the 128 font. I need only to convert my fields in SQL
Thanks... more >>
Help with a join...
Posted by Rob Meade at 1/11/2005 12:59:58 AM
Hi there,
I have a table which has several columns, two in particular are CreatedBy
and UpdatedBy, these both hold int values which I'm joing to my Users table
on the UserID column.
When I drag the column from one table to the other in Enterprise Manager's
design view for the view I do this... more >>
linked server error updating
Posted by Paolo at 1/11/2005 12:33:02 AM
Hi,
I've got a cluster server with sql server enterprise and 4 linked server
with sql personal edition in the LAN.
Sometimes when i run this query:
UPDATE ME41.Butterfly.dbo.StampaEtichetteSpedizione
SET Elaborato = 0
WHERE CodSettoreAziendale = 'B4' AND Stampato = 0
I get this error:... more >>
|