all groups > sql server programming > january 2005 > threads for thursday january 6
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
how to redirect the result from the query into the file
Posted by Flow of river at 1/6/2005 10:51:06 PM
hello,
iam new to the sql server. iam just working under the query analyzer, in
that i have a dout that is
1) how can i store the result of the query that is executed for ex:take a
selct query into the file. give the syntax for that command
2)how can i insert values into the table by ge... more >>
BCP/Bulk Insert from Unix machine
Posted by Vivek T S at 1/6/2005 9:31:12 PM
Hi,
I'd like to load data from a Unix machine into the SQL Server database
using one of the bulk loaders. I know there isn't a bulk loader for Unix
platforms.
However can someone recommend a method to do so in one application(doing a
manual ftp of the file to the windows machine and ... more >>
odbc bcp api vs BCP utility
Posted by Vivek T S at 1/6/2005 9:23:03 PM
Hi,
i have an interesting problem. I have an application which reads from a
flat file into program variables and pumps that data into SQL Server table
using the ODBC bcp API. (i.e. bcp_sendrow)
On the other hand if i use the BCP utility to load the flat file (in
character mode) into a ... more >>
Cast varchar(8000) to text
Posted by Christian Perthen at 1/6/2005 9:10:12 PM
Hi,
I have a problem saving a HTML string of concatenated varchar(8000)
variables into a text datatype column. The string end up being truncated. I
tried both using CAST and CONVERT but data still truncated.
-- insert HTML into table for further processing by ASP
INSERT INTO tblUserNo... more >>
Tracking BLOB field changes
Posted by Gary K at 1/6/2005 8:45:01 PM
G'day all. I've done a fair bit of reading the BOL & the newsgroups, but I
cannot locate anything about accessing the original data from BLOB
(text,ntext,image,etc) fields in triggers. We are still in the design stage,
but we have the changes to tables recorded in audit tables (via triggers)
... more >>
variable used as column name in select
Posted by tartasuga at 1/6/2005 8:43:47 PM
Hi everyone,
I have a simple (I hope) question to make. I'd like to pass a column
name as a variable in the select statement
the following is the structure of the table I'm using
CREATE TABLE [str_model] (
[Livello1] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[alias1] [nv... more >>
LoadFromSQLServer won't work......
Posted by jdionne NO[at]SPAM idealconsulting.com at 1/6/2005 8:34:07 PM
I have a VB.NEt Winform app deplyed on ServerA. I have a DTS package
on ServerB. When I try to load the package with:
package.LoadFromSQLServer(serverB, uid, pwd,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, , , , packageName)
Where serverB, uid, pwd are variables set in the program... more >>
truncate log file
Posted by Rafael Chemtob at 1/6/2005 8:21:16 PM
Hi,
I have a log file that is 37 GB big. I want to truncate it. I have no use
for it. how would I do this WITHOUT screwing up my data.
rafael
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
help me on this audit trail trigger
Posted by Matthew at 1/6/2005 8:21:02 PM
I need to track column level update info for all tables,and put them into
audit trail table.Because there're more than 100 tables, and most table has
more than 15 columns, so I don't want to use 'if update()' and 'insert into
audit_trail select ...' for every trigger. I put them into procedure... more >>
Problem with NULL--
Posted by AR at 1/6/2005 8:07:32 PM
Hi,
I am getting 'Zero' instead of null.
Here is the situation
declare @XML nvarchar(400)
declare @hDoc int
DECLARE @int int
set @XML = '<XML><tag></tag></XML>'
exec sp_xml_preparedocument @hDoc out, @XML
select @int = isnull(tag,9)
from openxml (@hDoc, '/XML')
with (tag int 'tag')
s... more >>
Do You Still 'Mind'?
Posted by Pike at 1/6/2005 7:37:51 PM
MVP Tony Rogerson wrote:
> I think the biggest mistake people make is not treating the database as
> part
> of the application, it is quite often treat as seperate entity.
> More scalable, more matainable and quicker developed applications can be
> built if application and database work toge... more >>
Surrogate Key
Posted by Amish Manubhai Shah at 1/6/2005 7:10:08 PM
Hi, all gurus
Can any one guide me about what is Surrogate Key, how it differ from others.
--
Thanking You
Amish M Shah
Sr.Software Engineer
IntraAction Software(Ahmedabad, India)
Mo - 9879398697
... more >>
Continuous varchar data
Posted by Murat BUDAK at 1/6/2005 5:47:06 PM
I have got following type Records. I need that I have to check continuous
record structure like following table.
idCol StartPort EndPort
1__A to B <-- Rec1
2__B to C <-- Rec1
3__C to B <-- Rec1
4__B to A <-- Rec1
5__B to A <-- Rec2
6__F to Z <-- Rec3
7__Z to F <-- Rec3
How can I che... more >>
How to send to log file?
Posted by rerichards at 1/6/2005 5:17:35 PM
I am running Win2K Management Console and set up items to monitor, but
how do I get this data to be stored into a file to be used either for
historical purposes, later review, or compare with profiler data?
... more >>
Update question
Posted by simon at 1/6/2005 5:05:34 PM
I have table ORDERITEMS, where I have items of orders for different
countries (different countries can have the same order ids):
COUNTRY_ID
ORDER_ID
ITEM_ID
VALUE
POSITION
I would like to UPDATE position of item of the order regards to it's value.
The item with greater value should hav... more >>
weird symbol
Posted by Darren Woodbrey at 1/6/2005 4:40:21 PM
I have exported a database from an old Filemaker file. I exported it to a
..csv file and then imported it into a new sql table. Some of the entries
have a weird looking square symbol after them. I am sure that this has
something to do with a carriage return. The question is, how do I get r... more >>
Stored procedure to return record set
Posted by Alan at 1/6/2005 4:32:11 PM
To retrieve one record, I use the following:
Create PROC proc_IdentificationsDetails (
@IdentificationID INTEGER,
@ShortDesc VARCHAR(8) OUTPUT,
@LongDesc VARCHAR(64) OUTPUT)
AS
SELECT @ShortDesc = i.ShortDesc, @LongDesc = i.LongDesc
FROM Identifications i
WHERE i.IdentificationID = @Ident... more >>
lookup description
Posted by smk23 at 1/6/2005 4:27:05 PM
from a newbie (and thanks for your patience):
When I need the descriptive interpretation of a value in a column, is the
most efficient thing to do a lookup in the Select statement for loading a
form? In MS Access, I do this with a DLookUp function. The value is in
another lookup table. How wo... more >>
how to verify membership in db_owner group...
Posted by Brett Davis at 1/6/2005 3:33:32 PM
hello,
I want to write a query that will tell me which users in a given database
belong to the db_owner group. This is something that i want to run in a lot
of databases and I do not want to use the enterprise manager. i am using
SQL Server 2000.
thank you,
Brett
... more >>
Procedures
Posted by Andrew Clark at 1/6/2005 2:29:13 PM
Hello,
I have a small procedure that I want to apply to a table. What is the
syntax for that?
CREATE PROCEDURE foo @in VARCHAR(32), @out OUTPUT
AS
[...]
DECLARE @output VARCHAR(255)
UPDATE tablename SET column = (EXECUTE foo 'Andrew', @output OUTPUT)
-- this isn't right...
Thanks,
... more >>
Aggregating strings
Posted by John Baima at 1/6/2005 2:13:33 PM
I have a select like
select Contact_FirstName + ' ' + Contact_LastName as ContactName
from tblContact where Contact_ID = XXX
I would like to use this result as a derived column in a larger
SELECT, but the problem is that there can be multiple records matching
here, and I would like one str... more >>
flag "duplicates"
Posted by raybouk at 1/6/2005 2:01:01 PM
When I have duplicates, how do I mark the originals with a 1 and "duplicates"
with a zero? Preferrably I would like the last "duplicate" in a series of
duplicates to be 1. Below is a simple case I have created. Thanks! - ray
desired results:
MyCode Original
A 1
B 0
B 1
C 0
C 0
C 1
... more >>
Dynamic Server Reference in T-SQL
Posted by Microsoft Newsgroup at 1/6/2005 1:50:44 PM
Hi,
I have two Server (Server1,Server2). Calling a Stores Procedure with the
server name as parameter,
Create Store Procedure (@prmServer Varchar(500))
As
Select * From ##.pubs.dbo.Titles
Now my question are
How i execute T-SQL in the SP using the Server parameter(##- part) without
... more >>
How can I get the current project / application path?
Posted by Geri Reshef at 1/6/2005 1:31:14 PM
Recommended Fill Factor
Posted by rerichards at 1/6/2005 1:26:00 PM
I have inherited a table with a primary key Clustered Index on a
identity based column with a Fill Factor of 90%. This table also
contains a second composite index of two columns that also has a Fill
Factor of 90%.
A web service inserts about 40,000 records per day into this table.
Throughout... more >>
Help with performance of sql construct
Posted by Michael Schwab at 1/6/2005 1:09:39 PM
Hi everybody,
I am using the following view:
SELECT a.ID_Address, a.kitchen, Name_Address = CASE WHEN NULLIF
(a.FirstName, '') IS NULL
THEN a.FamilyName ELSE a.FamilyName + ', ' + a.FirstName END
FROM dbo.vwAddress a LEFT OUTER JOIN
dbo.tblInternal i ON a.ID_Address = i.ID_Address LEFT OUT... more >>
Unexpected result on Between dates query
Posted by Peter Newman at 1/6/2005 1:09:03 PM
im trying to run a query to return records that have a date between two dates
Applied Date is a datetime field
when i run this query i only get one record returned instead of the three
Select Desription, AppliedDate
From Bossdata.dbo.DebBacsFM_Balances
Where AppliedDate Between (convert(d... more >>
Using temp tables
Posted by Roy Goldhammer at 1/6/2005 12:40:50 PM
Hello there
I have application on sql server 2000
In the application i need sometimes to store result of store procedures or
other things into tables for some time and destroy it afterword. By that
time this dable should be watching on all the network.
As I understand i should use temp ta... more >>
converting ntext to image datatype
Posted by Harper Trow at 1/6/2005 12:35:06 PM
I have a table with an ntext column and a related table with an image
column. I am trying to get the data in the ntext column in the first table
into an image column in the second table. Since no direct conversion of
those two data types is allowed, how can I convert or get the ntext data
... more >>
How can I apply a stored procedure to each column in a table.
Posted by Vern at 1/6/2005 12:17:02 PM
Obviously, I'm brand new with stored procedures. Everything I've looked at
works with a function but not a stored procedure, so I tried putting the call
to the stored procedure inside a function, but when I run it, it says I can't
do this. Here's what I'm trying to do:
select dbo.stored_p... more >>
DTS Run - spaces in dts names
Posted by Rob Meade at 1/6/2005 12:12:25 PM
Hi all,
I am trying to execute a DTS from a Job, there are spaces in the DTS name, I
thought by placing "'s (quotes) around the DTS name this would get around
the problem - alas it does not - can anyone tell me how I can get around
this? Do I need to use an escape character infront of the q... more >>
view w/ trigger and set operations
Posted by Craig at 1/6/2005 12:05:04 PM
Can a view with a trigger handle a set operation, for example an, can an
'INSTEAD OF' insert on a view handle something like:
insert into ViewWithTrigger
select top 10 * from sourceTable
I only seem to get the last record in the recordset to actually do the
insert. Also all the exam... more >>
not null sp params
Posted by Param R. at 1/6/2005 11:10:29 AM
Hi all, is it possible to specify a parameter for a sp as not null? If yes,
what is the syntax for doing so in sql2k?
thanks!
... more >>
SP for list of table dependencies
Posted by John B at 1/6/2005 11:04:10 AM
Hi
I need to write a SP to generate a list of
(a) all the tables that reference tableX (ie they have a foreign key that
links to this table)
(b) all tables that tablex references (ie tablex has a foreign key that
links to them)
Thanks in advance
John
... more >>
updating data from different server.
Posted by PVR at 1/6/2005 11:00:19 AM
Hi Sql Gurus,
There are two databases A and B on two different servers
s1 and s2. I added 20 New colummns to the existing table
on database A on server s1.
Table ROW count on Database A 3381190
(20 old columns - 20 new columns which are added newly)
Table ROW count on Database B 395... more >>
stored procedure vs its equivalent SQL statement
Posted by Andrew at 1/6/2005 10:55:06 AM
Hi friends,
In SQL Server 2000, if I run a stored procedure,
exec sp_ModifyReleaseResource 0, 2045, 1054, 1584, 1
I got an error, saying: Violation of UNIQUE KEY constraint
'IX_ReleaseResource'. Cannot insert duplicate key in object 'ReleaseResource'.
However, if I run its equival... more >>
Basic DTS Transformation Problem - Need Help
Posted by DavidM at 1/6/2005 10:49:04 AM
Hi all --
I'm trying to write my own ActiveX transformation script to copy some fields
from an old table using a couple different data types to a new table. I
seem to be having problems with the different data types and can't get DTS
to run with them. I'm sure it's just due to my in-exper... more >>
preferred syntax for aliases
Posted by Sansanee at 1/6/2005 10:47:05 AM
I am trying to figure out what is the standard and most acceptable syntax
for aliasing that will work across different applications like access,
Oracle, etc. I found out that all of the following syntaxes work with SQL,
but I am not sure which is the most acceptable across platforms:
SELECT l... more >>
Unique Index and Primary Key - bits - confused
Posted by terryshamir NO[at]SPAM yahoo.co.uk at 1/6/2005 10:32:51 AM
Hi
I always thought that having a primary key was a unique constraint
(with no nulls allowed) + an index. So primary key made selects faster
because you had an index.
A Bit can be part of a Primary key but not form part of an index.
So whats going on here then????... more >>
How to get the return code backf rom the stored procedure.
Posted by dev_kh at 1/6/2005 9:59:06 AM
Hi,
I am calling a stored procedure like this in vb.net:
objCommand = New OdbcCommand("{call add_proposed (?,?,)}", objODBCConnection)
objCommand.CommandType = CommandType.StoredProcedure
'Pass in the params
objCommand.ExecuteNonQuery()
Everything works fine here but I am not able to... more >>
8000 character datatype limit
Posted by Don at 1/6/2005 9:48:35 AM
Hi:
I am using a DTS package to import data into a table. However, the text
in one of the colums is over 8000 characters.
How do I get around this? Is there another datatype that I can use?
Any links that you can send me to for this?
Thanks,
Don
... more >>
how to select month and year from a smalldatetime column
Posted by Dan D. at 1/6/2005 9:01:05 AM
What is the most efficient way to get a month and date from smalldatetime
column. Right now we're using this:
Select refid, branch from table1
where (cast(year(date_sold)as varchar(4)) + '_' + cast(month(date_sold)as
varchar(2))= '2004_12'
Is there a more efficient way?
Thanks,
--
D... more >>
Update question
Posted by Phill at 1/6/2005 7:49:01 AM
Is there a more efficient update statement to update a country field with
either US of CA, in one statement? Currently I use two Update statements.
Thanks.... more >>
Crosstab query
Posted by paulhk88 at 1/6/2005 7:27:02 AM
I am new to SQL Server programming. I am trying to upgrade my MS Access
database into SQL server. I have got the tables imported into SQL server.
Amongst the queries I have, is a crosstab query in MS Access which I am
trying to make it work in a similar way in SQL server. My table has records ... more >>
Latest Record (again)
Posted by Paul in Harrow at 1/6/2005 7:19:01 AM
Hi there
I still can't get this to work
Table Paul
F1 Char ----Name
F2 Smalldatetime ----Event Date
F3 varchar(30) ------Event Action (choce list on the front end)
Data:
F1 F2 F3
---- --------------------------- ----------------------... more >>
Anyway to Make Query More Efficient?
Posted by tarheels4025 at 1/6/2005 6:27:05 AM
Here is my query:
Use WinPayment
GO
SELECT
pos_condition_code,
convert(char(11), retrieval_reference_number) RR,
message_type,
authorization_identification,
convert(char(8), card_acceptor_identification) SN,
convert(char(25), transaction_name) TransactionName,... more >>
alter tables add 365 columns
Posted by Boonaap at 1/6/2005 6:25:04 AM
i need to create a table with a column for every day of the year
but i don't feel like typing everything manually
so far i have this
CREATE TABLE tblMyTable
(
Column01PK int NOT NULL IDENTITY(1,1) PRIMARY KEY,
Column02 NVARCHAR(50) NOT NULL
)
GO
DECLARE @x int
@x = 1
WHILE @x < 3... more >>
reduce physical memory usage by updating ntext field
Posted by Shai Goldberg at 1/6/2005 6:09:06 AM
Hi,
I have 5 ntext fields that have 40k value string each for every record
The table has 23,000 records so the table occupies about 3G of data.
So I tried to changed values inside the ntext fields to be a string such as
'Deleted' in order to free some memory, this data in no longer needed.
I... more >>
Copy complete tables - What is the best pattern?
Posted by Xian at 1/6/2005 5:59:02 AM
Hi Space!
I need some pattern (optimized for ressource usage and then speed) for doing
the follwowing:
In my DB there are two tables "TableA" and "TableB" which are complete
identical (100% same schema).
TableA is the "master" tabele which will be updated (add, update, delete
entries) f... more >>
Convert 2000 script to version 7
Posted by j_dlaw at 1/6/2005 2:29:02 AM
I have a client still running SQL Server 7 and I have a large SQL upgrade
script generated from SQL Server 2000 to send them. Unfortunately the script
was not created with the 'compatible with SQL Server 7' check box ticked,
plus it was generated from a development database that has now moved ... more >>
Thoughts - Saving Word documents in SQL Server?
Posted by Andy at 1/6/2005 1:45:01 AM
Hi,
One of our departments would like to store their contracts (currently in
word format) in a database. Proposed changes can be made by other departments
but must be approved by the contracts people. Therefore changes between the
old version of the document and the new version must be easily... more >>
|