all groups > sql server programming > august 2004 > threads for wednesday august 18
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
storing and searching office docs in SQL
Posted by aussie rules at 8/18/2004 11:52:18 PM
Hi,
Can you store an office doc, like a word or excel document in a SQL field,
and then somehow search within the contents of the office document for
words.
Is there somewhere i can read up on this ?
Thanks
... more >>
default sorting by id occurence?
Posted by Guy Brom at 8/18/2004 8:38:11 PM
I'm passing a varchar list of digits (5,1,2,309,171) to a WHERE clause.
Something like:
SELECT * FROM Products
WHERE pid IN (5,1,2,309,171)
SQL uses the default sorting column (in this case I belive it's the pid,
which is also the PK).
Is it possible to maintain the sorting order simi... more >>
how to return alphanumeric data only?
Posted by Girish at 8/18/2004 8:24:58 PM
Is there a way to test a "text" data type field or a "varchar" data type
field if it contains data with characters in it? If the data contains
numeric values, its ok. I just want to return rows that have characters in
them.
Thanks a mill!
Girish
... more >>
Database size / table size?
Posted by Rob Meade at 8/18/2004 7:16:38 PM
Hi all,
Is there a 'quick' and efficient way to return the following;
1. current database size (as per what you see in the GUI via enterprise
manager)
2. total rows (without using a COUNT() function)
3. size in mb for the table
Any info appreciated..
Regards
Rob
... more >>
Select Multiple Text Columns
Posted by Paul at 8/18/2004 6:51:15 PM
Hi Guys
I am looking to select an arbitrary no of columns e.g. firstname, surname,
position and separate the results with say a dash. e.g. If all columns exist
it may say: -
'Joe - Bloggs - Programmer'
However, if the person did not have a surname it would say 'Joe -
Programmer'. The thi... more >>
xp_sendmail help
Posted by Reg Besseling at 8/18/2004 5:48:20 PM
Hi all
I need to send reports using xp_sendmail
I wnat the mail to have a csv attachment so it can be double clicked and
then be opend in excel.
The problem is that the file that is attached to the mail is Unicode and
excle does not automaticaly open it
how do i fix this
attached is... more >>
MULTIPLE SQL INSTANCES
Posted by MS User at 8/18/2004 5:04:23 PM
SQL 2K / WINDOWS 2003 SERVER
I have a box with 2 SQL INSTANCES and each instances with few databases.
Memory is setup to 'Use a fix memory size' and setup with half and one GB
each .
Almost 250 GB free hard-disk space and both instances using 4 processors.
I have different SQL jobs running ... more >>
Stored Procedure
Posted by Ed at 8/18/2004 4:53:02 PM
HI,
I have two identical databases on the same server. How am i able to
create one stored procedure that can be run on both. Is there somthing like
a master stored procedure?
Thanks.
Ed... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Column...
Posted by José Araujo at 8/18/2004 4:22:00 PM
Hi,
I want to change the type of a column to be IDENTITY without drop/adding the
column again...
I know I can go and modify the information in SYSCOLUMNS, but that leaves
the database inconsistent (no seed is generated, and it doesn't recognize
the column as IDENTITY).
Has somebody done ... more >>
Backup SQL
Posted by Jon Glazer at 8/18/2004 4:19:44 PM
Does anyone have a super-duper step-by-step setup for backing up a database
from one server to another regularly? Something efficient and quick?
Thanks!
Jon
... more >>
DTS doesn't log
Posted by Jon Glazer at 8/18/2004 4:13:38 PM
Why is my DTS job log empty. I don't see anything to review at all and I
want to confirm jobs do run?
Thanks!
... more >>
DTS works manually but not automatic
Posted by Jon Glazer at 8/18/2004 4:13:15 PM
Any reason why this would happen? I have a DTS job that copies an entire
database to another server but it doesn't seem to want to work when run late
at night automatically. It does work if I select execute myself. Any
reasons why?
... more >>
best method for counting records?
Posted by Jon Glazer at 8/18/2004 4:11:49 PM
I have a database with millions of records in a table. I want to count them
regularly but it seems that as the database builds doing a "select
count(whatever)" takes longer and longer. Is there a better way?
Thanks!
Jon
... more >>
Consolidating several columns into one
Posted by Steve W at 8/18/2004 3:55:33 PM
I have a dataset pulled from three tables I am presenting to a web page. Of
course, when I push it to a datagrid, the first three columns are dates
pulled from each table. It looks like:
Delivery Date|Adjustment Date|Lifted Date|Yada|Yada|Yada|Yada
01/01/2004 NULL NULL
NULL ... more >>
What is the best way to handle a data feed?
Posted by Robert Taylor at 8/18/2004 3:42:11 PM
I am working on a project where we will be getting a nightly feed of
data that is to be used to either add new records or update existing
records.
We would rather not do inserts/updates based upon a general join across
the data feed and the existing table (ie data_feed inner join
data_table) ... more >>
Format %
Posted by Jeff at 8/18/2004 3:38:46 PM
I am asking this here, because I don't see a general sql NG. Onlt for SQL
server.
Anyway, This is for Access DB. This query works, I would just like to format
the percent.
SELECT rounds.UserName, Sum(quniroundWithMatches.Win) AS Wins,
Sum(Abs([Win]=0)) AS Losses, Sum(1) AS Total_Games, Sum([W... more >>
Better way to insert a range of rows?
Posted by howard NO[at]SPAM nospam.nospam at 8/18/2004 3:13:03 PM
What is a good way to insert a specified number of rows into a table, where
in each row one field contains a sequence number, and the rest of the fields
contain either a fixed given value or a default value? I used an INSERT
inside a WHILE loop but I wonder if there is a more efficient way.
... more >>
Creating Composite Fields or Colum name...
Posted by unit_1002 NO[at]SPAM hotmail.com at 8/18/2004 2:38:54 PM
Hi !
I have to acces multiple column (just like Periode1, periode2, etc.)
of a table in a FOR LOOP.
I would like use something like this :
FOR i IN 1..10 LOOP
SELECT @MyVal = ("Periode" + i) FROM Charte WHERE ...
/*.... do something with @MyVal
END LOOP
How could I create "O... more >>
Date Condition?
Posted by Bobby at 8/18/2004 2:37:29 PM
Hi....
I want to filter data and the condition is base on DT_JOIN...
I want to get data where DT_JOIN = '1/5/2004', but I can get the right data
(I know the problem, because of the time)
How can I filter data only base on date?
I use
where DT_JOIN between '1/5/2004' and '1/5/2004 23:59... more >>
Existing TempTable
Posted by Ed at 8/18/2004 2:33:02 PM
Hi,
How am i able to check if the temp table (##TempTable/#Temptable) already
exists in TempDB using T-SQL since I am already in user database.
Thanks
Ed... more >>
Using "Like" against an empty string '%%'
Posted by Raterus at 8/18/2004 2:15:35 PM
Hello,
Here is my problem, I'm trying to "upgrade" a table to not allow null =
values, but this has introduced an issue into some SQL that I use to =
query this table. Before, when I had NULL values, I could get away with =
a statement like this
Select *
from myTable
Where myValue like '... more >>
referencing an alias column
Posted by Guy Brom at 8/18/2004 2:06:25 PM
I'm trying to reference an aliased column (defined on the SELECT clause) on
the WHERE and ORDER parts. Is this possible?
SELECT
COALESCE(Price1,Price2) AS MyPrice
FROM
Products
WHERE
MyPrice > 10
ORDER BY MyPrice
BTW, I was able to solve the ORDER BY Part by using:
ORDER BY 1 (colu... more >>
Foreign Key
Posted by Anya at 8/18/2004 1:53:56 PM
Is there a way to declare an fk contraint that would
reference a composite primary key in another table?
For example, I have table_1:
create table table_1 (order_num integer, order_desript
varchar(10), order_dt smalldatetime
constraint order_pk primary key (order_num, order_dt))
Now I ... more >>
Backup database in four segments
Posted by Mike at 8/18/2004 1:47:27 PM
Help help me create script that I can backup the database
on four segments. The reason I am dividing the backup in
four segments so that I can copy the files to another
server and restore.
Database backup file names (TAJ.BAK, TAJ_1.BAK, TAJ_2.BAK,
TAJ_3.BAK)
I would like to apply t... more >>
using round function
Posted by Gerry Viator at 8/18/2004 1:38:30 PM
Hi all,
Trying to get rid of the trailing zeroes?
Declare @pertotalforA varchar(20)
SET @pertotalforA = cast(round((100.0 * cast(@Total_totals as numeric)) /
cast(@totalforA as numeric),2)as varchar)
returns 4.0200000000000000
thanks
Gerry
... more >>
Create a read only stored procedure
Posted by Heriberto at 8/18/2004 1:30:08 PM
Hi, I would like to know how to create a stored procedure but not let the
user edit it in Enterprise Manger like system's procedures. With the option
ENCRYPTION I cannot read it and my concern is just don't let the user change
it.
Thanks
... more >>
Problem calling stored procedure with CRecordset
Posted by Shawn at 8/18/2004 1:19:58 PM
I'm attempting to call a stored procedure to fetch some data using a
CRecordset object. Everything works fine for awhile and then, for reasons I
can't readily explain, the call to CRecordset.Open(...) never returns.
I ran SQL Profiler on the server and noted that when this occurs the sproc
had... more >>
Help with dynamic query
Posted by priyanka NO[at]SPAM radiotime.com at 8/18/2004 1:11:28 PM
Hi All,
I having trouble with this query
declare @ExecStr varchar(2000)
declare @country_no int
set @country_no = null
set @ExecStr = 'select * from station_tbl where '
+' country_no = COALESCE('+ @country_no +',
country_no)'
exec (@execstr)
I get the error "Synta... more >>
Help with dynamic query
Posted by priyanka NO[at]SPAM radiotime.com at 8/18/2004 1:11:18 PM
Hi All,
I having trouble with this query
declare @ExecStr varchar(2000)
declare @country_no int
set @country_no = null
set @ExecStr = 'select * from station_tbl where '
+' country_no = COALESCE('+ @country_no +',
country_no)'
exec (@execstr)
I get the error "Synta... more >>
datetime, caluclated column design question
Posted by Bob at 8/18/2004 12:32:22 PM
Say I want to store labor-tracking data in SQL. Each employee submits one
timesheet per week, which will have some header information associated with
it, like when it was submitted. I need to constrain this header table so
that can employee can have no more than one timesheet per week. In my
ear... more >>
Use of case statement in where clause
Posted by Parag at 8/18/2004 12:09:03 PM
Hi,
I am using following query -
select * from t_act_fact_table where
SUB_PRODUCT_ID like
( case @xyz
when 'LCL' then (select [ID] from T_DIM_SUB_PRODUCT where VALUE like
'LCL')
when 'FCL' then (select [ID] from T_DIM_SUB_PRODUCT where VALUE like
'FCL')
... more >>
Query Data Type Length
Posted by Andrew Jones at 8/18/2004 12:07:52 PM
Is there a way to query a table and pull out a field data type and length?
That is, length as defined, not length of the data in the field. For
example, if I have a varchar(2000) field with 100 bytes of data. Can I
query the table to pull out the 2000?
THanks,
Andrew
... more >>
SQL Harness
Posted by Vai2000 at 8/18/2004 11:29:39 AM
Is there a tool by which I can check the Heartbeat of SQL Servers? Lot of my
apps are throwing SQL Timeout exception, so I was wondering maybe I can test
harness the SQL via a tool....
I can write one but just wanted to check is there already something
available!
TIA
... more >>
Tool
Posted by SKG at 8/18/2004 11:01:50 AM
Is there any MSSQL tool like TNSPing for Oracle
I just want to check whether i can ping to a running instance of sql server
on network.?
Thanks!!!
... more >>
nondeterministic expressions (continue)
Posted by aoxpsql at 8/18/2004 10:21:46 AM
Thanks gyus,
I use a new post since we have at least 9-15 hours difference from where I
am writing. Here is the code to the view:
CREATE VIEW carrc.Vw_Summary_Reports1 with schemabinding
AS
SELECT carrc.Vw_REPORT.projid, carrc.Vw_REPORT.[Date],
carrc.Vw_REPORT.fees,
carrc.Vw_REPORT.di... more >>
Really strange problem with stored procedure and VB6
Posted by Ian at 8/18/2004 10:19:38 AM
Hi
I was hopping some one can give me an explanation for this.
Stored Procedure: (All this is in one stored procedure but this is the basis
of what it does)
Step 1: I have a stored procedure that selects some records from tblTableOne
into #Temp1.
Step 2: It then goes to and excel workboo... more >>
Stored Procedure
Posted by Savas Ates at 8/18/2004 10:19:07 AM
my procedure
************************
CREATE PROCEDURE sp_test1 @surname varchar(500), @onlinestatus bit AS
declare @sorgu varchar(500)
set @sorgu='select * from users where 1=1'
if @surname<>''
set @sorgu=@sorgu+' and surname=@surname'
if @onlinestatus=''
set @sorgu=@sorgu+' and onlinesta... more >>
Slow SQL performance
Posted by ASP.Confused at 8/18/2004 10:12:18 AM
I just found out that my web host's database server is located over 1000
miles away from the web server...is there anything I can do within my code
to optimize the speed of my queries? It currently takes about 1 second to
process any query that I perform.
... more >>
query analyser problems - novice question
Posted by Joey at 8/18/2004 9:54:51 AM
Hi There,
I am trying to use the query analyser to execute my stored procedures and I
keep getting the error message below, what am I doing wrong?
Joey
Formal parameter '@userid' was defined as OUTPUT but the actual parameter
not declared OUTPUT.
declare @errmsg1 nchar(200)
declare ... more >>
Record Count Messages order with triggers
Posted by Robert Taylor at 8/18/2004 9:13:56 AM
When a script is run against a table with INSERT and UPDATE triggers,
and QA returns x number of records updated then y number of recrods
updated, is there any way to determine which message applies to your
update versus the trigger's update?
Thank you.
Robert
*** Sent via Developersde... more >>
scheduled job
Posted by Joe at 8/18/2004 9:12:46 AM
I created a job. From the 'Advanced' tab of the 'Edit Job
Step', I specify the output file for the Transact-SQL
command options. When I ran the job, the output file
always show the number of rows affected when I use SELECT
statement even if I SET NOCOUNT ON, or show [SQLSTATE
01000] when I... more >>
random number generator
Posted by don evan at 8/18/2004 8:49:21 AM
Im trying to create a large table for test data with
customer ssn and stuff
For ssn I tried the folowing in a loop. I removed the loop
to resolve. The following should give me a two digit
random number but only gives me the first number
DECLARE @random varchar(1)
DECLARE @ssn varchar(9)... more >>
Delete characters from a string
Posted by Brian Shannon at 8/18/2004 8:36:38 AM
I have a column in my DB where data looks like the following
Lumber Specialties - Brian
Jon's Construction - Dave
UBC (Davenport)- Terry
When I query the DB and return the column I only want to display the name.
I know there is a function to tell you how many characters it is till the
firs... more >>
Best way to do a join for tables under 2 different servers
Posted by wandali NO[at]SPAM rogers.com at 8/18/2004 8:33:44 AM
Hi,
I am using ADODB in VB6...I tried to do a join for 2 tables in 2
different servers, how can this be done?
What I want is something like that
strSQL = "Select * from server1..db1..table1 t1 inner join
server2..db2..table2 t2 on t1.id = t2.id"
dim rs as ADODB.recordset
set rs = ne... more >>
Looking for Elegant Solution for sharing a temp table
Posted by Bradley M. Small at 8/18/2004 8:23:08 AM
I am in the process of writing 3 different stored procedures to modify
values at a very low level, but I must act on selections made at
progressively high levels. In a traditional language I would do this with a
subroutine but in this case it would be pretty good if I could pass around a
tempora... more >>
importing data & modifying a field
Posted by Kel at 8/18/2004 7:19:56 AM
I need to import a text file into SQL Server and need to
stip off the "-" in the social security field while
importing. Is there a way to do this?
Thank you, ... more >>
Binary Collation for code page
Posted by Michael Bauers at 8/18/2004 7:15:34 AM
I am attempting to come up with a solution to the
following problem:
I will be retrieving data from columns which will have non
latin-1 collations. Could be Cyrillic for example.
I am writing stored procedures to work with this data, and
write it to new tables. Ultimately these new t... more >>
SQL SERVER capacity
Posted by Enric at 8/18/2004 6:41:02 AM
Dear all,
I ask myself, which Sql Server limit is when we are speaking tables like the
following?
1,635,778,910 rows. This table is used in production, day in day out.
Thanks for that,... more >>
SQL comparison bug?????? Help Please...
Posted by steckedk NO[at]SPAM apci.com at 8/18/2004 5:44:52 AM
I'm trying to do a simple comparison on 2 decimal fields.
if @TempKPIValue > (@LastKPIValue + (@LastKPIValue * @TrendPadding))
Begin
if @TempTrendInverter = 0 Select @Trend = 1
if @TempTrendInverter = 1 Select @Trend = 3
End
The values are defined as...
Declare @LastKPIValue decimal(12,... more >>
Copying data while people connected
Posted by Steve Lewis - Website Nation at 8/18/2004 4:01:53 AM
If I copy a table (Table A) while people are connected to the database
and possibly modifying the Table A that is already in the server, what
will happen? I am assuming SQL server will hold the record modification
info in the transaction log and then commit the change once the table is
done ... more >>
Text datatype
Posted by Stevo at 8/18/2004 3:01:03 AM
I have a stored procedure that as one of its arguments takes a text datatype.
I need to call this stored procedure from inside a second stored procedure.
The problem I have is that the value of the text argument in the first
stored procedure need to be constructed in the calling stored proced... more >>
|