all groups > sql server programming > may 2007 > threads for friday may 25
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
truncate value of a float data type column to 4 decimal places
Posted by Cismail via SQLMonster.com at 5/25/2007 7:19:22 PM
Hello,
I have a table that contains values with 16 decimal places in the Weight
column(table definition below).
How can I truncate these values to four decimal places???
CREATE TABLE [Detail] (
[Transaction] [varchar] (10) NULL ,
[LineNb] [int] NULL ,
[Weight] [float] NULL
) ON [PRI... more >>
can this be one statement
Posted by rodchar at 5/25/2007 5:27:01 PM
hey all,
Table1
empId,fname,lname
1,john,smith
Table2
empId,date,salary
1,1/1/2005,$25
1,1/1/2006,$50
Table3
empId,startDate, endDate, jobPosition
1,1/1/2005,6/1/2005,director
1,6/2/2005,12/31/2005,executive
1/1/2006,null,ceo
i'd like to have a report like the following:
empID,fn... more >>
query for spaces in varchar column
Posted by mgm at 5/25/2007 2:15:48 PM
I want to query a column where it contains spaces such as:
John (beatle)
Paul (beatle)
George (beatle)
Ringo (beatle)
I want to return John's row, but this query ignores my spaces:
Select member from Band
where member like '% (%'
Thanks,
mgm
... more >>
Replacing beginning text in a field
Posted by Joe at 5/25/2007 1:46:41 PM
I am working with SQL 2005. Trying to replace/append text at the
beginning of a field. The [Table.field] in question is
[rim_image_attrib].[string_value]. The text may read for example: e:/
images/2007/05/02. I need to replace the "e:/" with "\\NAS\" on
criteria [rim_image_attrib].[attrib_type]=... more >>
LEFT JOIN Clarification
Posted by Shocky at 5/25/2007 1:12:13 PM
Please consider the following statements:
create table #pr (id INT,itemname varchar(25))
create table #msr (id INT,status varchar(25))
insert into #pr values(1,'a')
insert into #pr values(2,'b')
insert into #pr values(3,'c')
insert into #pr values(4,'d')
insert into #msr values(1,... more >>
Beginner problem with subquery
Posted by stacey.michols NO[at]SPAM gmail.com at 5/25/2007 12:04:47 PM
I am trying to find rows that match two different values in a column.
Example (using the 'sales' table from the 'pubs' database):
SELECT stor_id, title_id
FROM sales
WHERE ((title_id = 'bu1032') OR (title_id = 'ps2091'))
gives me:
stor_id, title_id
6380, BU1032
8042, BU10... more >>
Optimizing Join
Posted by Andy Eshtry at 5/25/2007 10:59:02 AM
I have a stored proc. containing the following query that took 90% of the
whole procedure execution time. Any idea how I can improve the performance. I
put some more info that SQL Server provides at the end. Thanks for your time
in advance and have a supper day!
best wishes
andy
AND (
... more >>
Optimization (System Tables)
Posted by CLM at 5/25/2007 9:06:01 AM
I wrote a script that finds all the indexes in a (user) database (in Sql
Server 2000) and then runs a defrag on those indexes. However, one thing
that I did was exclude all the system tables in said database. But that got
me to asking a couple of important questions:
1. Do I want to excl... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Privot Aggregate question
Posted by David Lawson at 5/25/2007 7:48:12 AM
Hi all,
I am using some of the pivot functionality in SQL Server 2005, I have
a problem and have found a work-around but would like to know if
anyone else has found this issue and what (if anything) I'm doing
wrong
Here is a very cut down version of what I have
SELECT [IMITM], [-1], ... more >>
Defining and SqlCommand parameter to a column that is a Checksum in C#
Posted by jeeji at 5/25/2007 6:55:30 AM
Hi
I have an MS SQL Server table declared as follows:
create table NameTable (Name varchar(300), NameChecksum as
CheckSum(Name))
Notice that the type of the second column is an int, and has the value
CheckSum of the corresponding Name value.
I am writing a C# program that will access t... more >>
date comparision in query.
Posted by Archana at 5/25/2007 6:21:27 AM
Hi all,
I want to compare two dates. I have one table in which i have datetime
field.
My query is as below:
SELECT * FROM table1
AND table1.dateadded > = convert(varchar(1000),getdate()-1,102)
Here I am confuse whether this query is right or wrong. Means do i
need to add convert ca... more >>
my first SP_Conversion failed when converting the NVarchar value to INT
Posted by Antonio at 5/25/2007 5:58:12 AM
OK so this is my first stab at a stored procedure and I am not sure
where i am going wrong. I want to start off saying that I now know
that I have alot of reserved words as column names and will be fixing
that eventually.
Basically the SP is inserting into 3 tables, 2 of which are dependant
... more >>
"Switch" table names in SQL Server 2005
Posted by Juaninho at 5/25/2007 5:02:01 AM
Hi
I wonder if there are any easy to use way to "switch" tables in SQL Server
2005..
My scenario is like this, lets say that i have a table called USER. I have
webservice that is are putting a lot of locks on the table then the service
is running. I want to have 2 USER tables (USER1 & US... more >>
Dates
Posted by Sundara Murthy at 5/25/2007 4:54:00 AM
Hi Experts
Serl_num Sys_mc_num cmplnt_date cmplt_date
C00026 179 2007-01-01 08:30:00.000 2007-01-16 16:50:00.000
C00027 182 2007-01-02 11:20:00.000 NULL
C00028 183 2007-01-06 13:10:00.000 NULL
C00029 184 2007-01-08 10:30:00.000 NULL
C00329 54 2007-03-01 15:27:00.000 2007-03-12 15:... more >>
Creating Linked Server to Oracle 9i - HELP!
Posted by bkgroups NO[at]SPAM yahoo.com at 5/25/2007 4:50:50 AM
Greetings all,
I'm unsuccessfully trying to create a linked server from SQL Server
2005 to Oracle 9i using OraOLEDB.Oracle. Here's the lovely error
message that I get:
OLE DB provider "OraOLEDB.Oracle" for linked server "test" returned
message "ORA-12504: TNS:listener was not given the S... more >>
Best update performance? (ORM)
Posted by ulrik NO[at]SPAM pragmasoft.dk at 5/25/2007 3:39:11 AM
I'm building an O/R Mapper where high performance is a key criteria.
My problem is how to update data in the database as fast as possible.
I have a simple (data transfer) object that correspond to a table.
This object knows which properties/fields have been changed.
As I see I have the following... more >>
up to 5 cols from 10 cols without dynamic sql or cursor?
Posted by adolf garlic at 5/25/2007 3:13:02 AM
I have a 10 column dataset (ignoring ID cols etc) with each column having a
different name.
I need to extract out up to a max of 5 cols (this will be determined by
whether SUM(col x)>0 but I know there will be always <6 cols)
I don't know at runtime which of 10 columns will contain data?
... more >>
Shrinking or Truncating?
Posted by Bob at 5/25/2007 1:55:54 AM
Hello folks.
I am working on an application that gets data from a JD Edwards system
and the data tables are frequently truncated before the new import.
So what I'd like to get some insight on is should I shrink the
database or truncate tables or do anything along these lines before or
aft... more >>
Get proc names excluding system procs
Posted by Josh Carver at 5/25/2007 12:00:00 AM
Hi group,
Using SQL Server 2005, I'd like to query my database to get a list of all
the stored procedures in it, excluding the system procs. I could do exclude
procedures whose names start with "sp_" underscore, but is there some sort
of system property I can query against instead to ensur... more >>
Combing XML and VARCHAR results
Posted by Arjan at 5/25/2007 12:00:00 AM
Hi all,
I am developing a stored procedure that will be used in a SOA concept. What
we have done is building an adapter for Coda Financials and Sonic ESB. We
use SQL Server 2005 for Coda. The server is running in compatibility level
80 as this is a requirement from Coda. To retrieve data fr... more >>
|