all groups > sql server programming > march 2006 > threads for thursday march 23
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
Prefixing
Posted by Shawnmb at 3/23/2006 11:24:16 PM
Hey everybody,
I've never had to write a script of this sort, so any help would
greatly be appreciated.
I'm looking to "prefix" every entry in a certain column, for example
lets use column "test2".
The data I have is "1" then "2" then "3". How could I append a "k" for
example; to the beginning... more >>
read file and exec contents
Posted by Andre at 3/23/2006 10:29:30 PM
I have a text file that contains "create index" statements - thanks to those
of you here who helped me get past my hurdles with this step earlier in the
week. :)
Now I need to read the file and execute it - basically execute the contents
of the file. I'm looking for suggestions on how to do... more >>
Successor to SQL-DMO?
Posted by Neil W. at 3/23/2006 9:42:33 PM
What is now the officially sanctioned way of obtaining schema information in
a program now that SQL-DMO is supposed to be old technology?
... more >>
Greater than zero
Posted by Eric_Singapore at 3/23/2006 7:53:55 PM
Hi all,
I have created a table and I need to make amendments to one of the
attributes. The attribute is set to accept integers but now I have to
change to accept only integers greater than zero. May I know how do I
make this change?
Thanks
--
Eric_Singapore
--------------------... more >>
Trouble in using bcp to get data into table for MS SQL 2005
Posted by SQL noob at 3/23/2006 5:37:02 PM
we are using microsoft SQL 2005 server, we are trying to put data.txt file
into the server, the file we put in have been edited below, the three names
of the column are written in the file. what we should use for the data type
of the table?
the following link is the data we have been edited,... more >>
error handling and transactions - speed question
Posted by Keith G Hicks at 3/23/2006 5:09:29 PM
I've been very carefully studying
http://www.sommarskog.se/error-handling-II.html recently. I went through it
some time ago before I was very familiar with working in SQL and it was all
sort of mysterious to me. Now I'm finding it to be very helpful.
Here's my issue right now: I have a former ... more >>
Timeout in SQL2005
Posted by simonZ at 3/23/2006 4:48:07 PM
In managment studio of SQL server 2005 I often get the following error:
Unable to modify table.
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
On the other hand in sql enterprise manager(sql2000) the same things works.
I... more >>
Multi Subquery and Like SQL Help
Posted by xenophon at 3/23/2006 4:12:52 PM
I want to do a match based on a multiple result subquery (I think),
which is making SQL Server 2000 angry.
With this DDL:
Create Table #par ( Combined VarChar(20) , Rowid Int )
Insert Into #par ( Combined ) Values ( 'aaaa aaa' , 0 )
Insert Into #par ( Combined ) Values ( '... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
smalldatetime or integer
Posted by simonZ at 3/23/2006 3:42:37 PM
I have to create some statistics based on datetime entry.
In my table I have datetime column, but all my entries for statistic are day
base(I don't need hours, seconds or minutes).
So, I decided to create another column where I'll put just date without
time.
I have 2 options: use smalldat... more >>
Using Select and Convert in procedure..
Posted by Habibullah at 3/23/2006 3:34:01 PM
Hi.
I can't figure this out. I like to select all the record from Table_tbl and
converting one field at the same time.
Here are two separate statements:
1: Select * From Table_tbl
2: Select convert (decimal (5,2),strcost) from Table_tbl
Goal is to get this both things done in one sho... more >>
Cannot Add SQL Server 2005 Mobile to Pocket PC Project.
Posted by Dan Bass at 3/23/2006 2:59:46 PM
-- Installed --
Visual Studio 2005 (.Net 2.0)
Sql Server 2005 Express
Sql Server 2005 Mobile SDK
I'm trying to add a "SQL Mobile Database" component to my Smart Device
project through Visual Studio 2005.
On one machine this works no problem (my laptop), but on my development
machine I... more >>
sp_start_job
Posted by Tejas Parikh at 3/23/2006 2:53:01 PM
I am unable to use the @server_name param of this sp. I can do this
exec msdb..sp_start_job
@server_name='shanghai\shanghai1',@job_id='7C256C70-D64D-4C1F-8D98-CA44C51698FC'
what I need to do is run this job on shanghai\shanghai1 instance from
ServerB but it's not working. If the job exists o... more >>
Trigger not working
Posted by d4 at 3/23/2006 2:16:10 PM
This is my first try at creating a trigger and I cannot get the
following trigger to work. I want it to add the ReqID from Request
table to Req2 table whenever a new entry is made in the Request table.
Any suggestions would be appreciated...
CREATE TRIGGER newreq ON [dbo].[Request]
FOR INS... more >>
OLEDB in .Net 2.0 web
Posted by David at 3/23/2006 1:38:00 PM
In my web page I am using the following OLE command to connect to a SQL 2005
db.
Dim conFileData As OleDbConnection
conFileData = New
OleDbConnection("Provider=SQLNCLI;Server=Server01;Database=Filedata;Trusted_Connection=yes;")
conFileData.Open()
How can I change this Provider to run f... more >>
What is notification services and how can it help me?
Posted by Brian Henry at 3/23/2006 1:05:35 PM
We just had SQL Server 2005 installed on our SQL Cluster... and was
wondering what do you guys use notification services for? what is it good
for? and any comments on it? thanks!
... more >>
Can Kill Command undo changes outwith a transaction?
Posted by woodk at 3/23/2006 12:49:10 PM
In SQL 2000 I have a problem whereby it appears that a process successfully
saved data (inserts followed by updates), hung, and when I killed the process
some of the data disapeared. I had understood that only declared transactions
would be rolled back, but in this case it appears that untrans... more >>
Combine results into one field
Posted by Joey Martin at 3/23/2006 12:31:44 PM
If I do a basic query
select * from grouping where code='12345'
I get the results
(fields are code,result)
12345 aaaaa
12345 assas
12345 f5fgh
I NEED to get it as aaaaa,assas,f5fgh. Since code is all the same, I
just want one result. Possible?
*** Sent via Developersdex h... more >>
Child Update in Single Statement From Parent?
Posted by xenophon at 3/23/2006 12:14:17 PM
I have a parent and child table (no FKs). In one (nested?)
TSQL statement, I want to update the child with a value
from the parent based on another column value.
Create Table #par ( ColA VarChar(10) , ColB VarChar(10) )
Insert Into #par ( ColA , ColB ) Values ( 'aaa' , '111' );
Insert I... more >>
SQL 2005 on X64 bit
Posted by ram at 3/23/2006 11:14:55 AM
I am facing run time issue with SQL 2005 SP1 on Windows 2003 SP1 X64.
SQL returns error, saying class not registered when we call CoCreateInstance()
--
HRESULT hr = CoCreateInstance(CLSID_SQLDMOServer, NULL,
CLSCTX_INPROC_SERVER|CLSCTX_ACTIVATE_32_BIT_SERVER,
... more >>
Using [ sp_getapplock ]
Posted by rmg66 at 3/23/2006 10:09:07 AM
I'm sorry if I'm being dense. But I don't quite understand how to use =
sp_getapplock.
Is it supposed to lock access to any db object (e.g. a particular stored =
procedure) until it is unlocked?
When I tested it. It didn't seeem to do what I expected....
I used it to lock a table object and... more >>
Copying structure of table form one database to another
Posted by kevin.jonas NO[at]SPAM gmail.com at 3/23/2006 9:49:16 AM
I am wondering if there is a simple way, like a stored procudure or
using some type of table object, to copy a table form one database to
another. Just the structure , index, triggers, I don't want the data.
... more >>
IF Update(@ColName) won't work...
Posted by Charlie NO[at]SPAM CBFC at 3/23/2006 9:39:48 AM
Hi:
Inside a trigger I would like to check if a field changed using Update()
function. However, the field name will stored in a variable, but IF
Update(@ColName) doesn't work. Why won't Update() accept a variable
argument?
Thanks,
Charlie
... more >>
Query Analyzer problem with NT login.
Posted by sqlapprentice at 3/23/2006 9:35:28 AM
Hello,
My SQL Server is set to "mixed mode". I am using TCPIP.
I can logon to the server physically, but I can't do it remotely on my
laptop from my Enterprise Manager or Query Analyzer. I am able to ping the
server from my laptop.
I don't have this problem with my other SQL Servers.
W... more >>
Read XML > 8k in sql TEXT column?
Posted by Paul at 3/23/2006 9:29:32 AM
Hi,
I have a SQL2k database that holds XML in a TEXT column because it is
greater than 8k, I need to extract the value from a couple of fields in the
XML. How can I do this? Examples would be great; I'm new to world of XML.
BTW I'm don't have control of the database design so I can't change th... more >>
SQL 2005 File IO programming
Posted by Mark at 3/23/2006 9:11:27 AM
We would like to add some capablility in our backup routines to move, copy,
and delete files after backups. For example: After the backup, copy the
backup file to another server, then delete old backup files. We use MSSQL
backups, SQL Litespeed, and red-gate software depending on the server.
... more >>
Storing result of Dynamic query to local variable
Posted by Charlie NO[at]SPAM CBFC at 3/23/2006 9:10:53 AM
Hi:
Is there a way to store result of a dynamic query to a local variable? For
example, why doesn't this work?
declare @var varchar (50)
set @var = exec('select customerid from customers where customerid =
''ALFKI''')
select @var
Thanks,
Charlie
... more >>
select, a join with a count?
Posted by HockeyFan at 3/23/2006 9:09:38 AM
I've got 2 tables; basically, topics and messages.
How do I list the topics and then the count for each topic?
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[udForumTopics]
@CompanyID int
AS
SELECT
T_ForumTopic.ForumTopicID AS "ForumTopicID",
T_Foru... more >>
Return records with the same social security number
Posted by Anonymous at 3/23/2006 9:07:36 AM
I have a table with FName, LName, SocialSecurity. I want to return the
records where the social security numbers are the same showing FName, LName,
SocialSecurity.
I did a count on SocialSecurity to find the numbers where there was more
than 1 record but I don't know how to return the FNam... more >>
Random selection of rows
Posted by Phil Hobgen at 3/23/2006 9:07:27 AM
Hi,
I need to select a number of rows from a query result. EG I may want to
return only 100 rows from a query that returns 500 rows. The rows returned
must be distributed across the query result set. If the same query is run
twice then a different 100 rows should be returned each time.
I... more >>
Data is truncated /SQL query help
Posted by Test Test at 3/23/2006 7:32:49 AM
Please help me to understand why the data is being truncated. Please run
this code. If you notice, the final @select does not show all the names
which are in the table. It is cutting off. (even though the length of
the @Name is declared to varchar(8000)). What I am missing?
Thanks for your he... more >>
Index hints in a view.
Posted by Alexander Korol at 3/23/2006 6:16:31 AM
Hi
SQL Server 2000 SP4
I am using view in my stored procedure. The view gets data from only one
table. I can not use table directly due to some reasons. I would like to add
an index hint to this table. Is View definition the only place for that? I
tried to add hint index to the view dire... more >>
View prevents stored procedure from caching execution plan?
Posted by Alexander Korol at 3/23/2006 5:56:44 AM
Hello
SQL Server 2000 SP4
According to the books View's execuion plan is recalculated each time the
view is accessed. Does it mean that if stored procedure queries data from a
view, possibly filtering output with WHERE clause its own execution plan will
also be recalculated each time?
... more >>
order by in derived tables
Posted by dawood bhai at 3/23/2006 5:41:49 AM
i cant manage to use order by clause in derived table...
it gives error msg::
incoorect syntax near key word order;
the query i wrote was...
select top 5 * from (select
Activity_date,Activity_Type,Activity_Id,Activity_Description from
ActivityDetails where pursuit_id like 110 order by ... more >>
About EM
Posted by Enric at 3/23/2006 4:55:32 AM
Dear all,
A pair of questions:
1)Why 'dtproperties' table appears as user table in sysobjects table?
2)Is there any way for to expand all the object once for all when you have
open EM at most top level? I mean, I've got 14 groups created and each of
them own n sql server registered.
Any inpu... more >>
Problem of resources lock with BEGIN..TRAN COMMIT..TRAN
Posted by Alextophi at 3/23/2006 4:28:00 AM
FR -*-*-
bonjour,
J'effectue plusieurs enregistrements provenant de plusieurs serveurs
dans une base SQL.
Mon probl=E8me est que l'enregistrement =E9crit des donn=E9es dans
plusieurs tables et donc quand il y a plusieurs centaines
d'enregistrements =E0 la m=EAme heure les donn=E9es sont m=E9... more >>
Entreprise Manager behaviour
Posted by Enric at 3/23/2006 4:25:28 AM
Dear all,
I've got the following scenario:
-Got two EM instances running at the same time. The same view on the right
for both, this is, Tables.
From EM1 I create a table called T. After that I'm going to EM2 and refresh.
Fine because I am seeing the same object.
-Come back to EM1 and... more >>
How do I.......
Posted by Eric_Singapore at 3/23/2006 4:01:05 AM
modify a new table name Table1 to include this condition:-
This new table has an attribute( which is a primary key ) and it takes
the value of another attibute from another table. The name of both
attributes are the same. Furthermore, it must take the value whose
other attibutes of the other ... more >>
Trigger: When deleting more then 1 row it doesn't trigger
Posted by Andreas Klemt at 3/23/2006 3:25:45 AM
Hello,
I have this
ALTER TRIGGER [mytableDelete] ON [dbo].[mytable]
FOR DELETE
AS
SET NOCOUNT ON
DECLARE @user_id int
SELECT @user_id=user_id FROM deleted
DELETE FROM users WHERE user_id = @pa_id
Now this works fine when I only delete one row like this
DELETE FROM mytable WHERE id=1
... more >>
Service Broker - The right approach?
Posted by Christopher Quest at 3/23/2006 3:24:27 AM
I am working on a project that uses a modified version of the A.R.T.S.
database at H.O. This contains data for each client located in a hierarchical
location (I.e. Country\Region\City\Store\Client). I have code that can
extract the subset of the data for a specific client, what I now need to d... more >>
Help with Select Minimum Value
Posted by Stephen K. Miyasato at 3/23/2006 3:13:59 AM
I need help in doing a select statment with a minimum
here is the statement
CREATE TABLE [Test] (
[rIndex] [int] IDENTITY (1, 1) NOT NULL ,
[Defaul_] [int] NULL ,
[FilterType] [int] NULL ,
[ProtScr] [int] NULL ,
[ProtRank] [int] NULL ,
[Description] [varchar] (50) COLLATE SQL_Latin1_... more >>
Reg:Passing Parameter to Trigger
Posted by SivaprakashShanmugam at 3/23/2006 3:12:28 AM
Hello
Is there any possibilities to pass parameters to Triggers if so How?.
Siva.... more >>
Concatenation and NTEXT
Posted by Jono at 3/23/2006 2:49:44 AM
Hi everyone,
I have a problem trying to update an NTEXT column by enclosing it
between two strings, as shown in the SQL below:
UPDATE MyTable SET NTextField = N'<pre>' + NTextField + N'</pre>'
The error I get back is this:
Invalid operator for data type. Operator equals add, type equals n... more >>
Help on elapse time to return data ????
Posted by serge calderara at 3/23/2006 2:47:33 AM
Dear all,
I have build an ASP.net application which calls different store procedure.
When my customer request data from store procedure, I would like to display
on the page, the time it takes to return data.
How to do that ?
regards
serge... more >>
Update the salary of each manager to be double the average salary of the employees he/she manages
Posted by satish at 3/23/2006 2:23:16 AM
create table employee(empid int,empname varchar(20),managerid int not
null, sal int)
insert into employee values(1,'ranga',22,5000)
insert into employee values(2,'satish',22,8000)
insert into employee values(3,'sunil',11,4500)
insert into employee values(4,'sridhar',22,2000)
insert into e... more >>
[FR/EN] How to make several hundreds of recording at the same time?
Posted by Alextophi at 3/23/2006 2:13:38 AM
FR -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
bonjour,
J'effectue plusieurs enregistrements provenant de plusieurs serveurs
dans une base SQL.
Mon probl=E8me est que l'enregistrement =E9crit des donn=E9es dans
plusieurs tables et donc quand il y a plusieurs centaines
d'enreg... more >>
HELP!!!!!!!!!!!!!!
Posted by urgent at 3/23/2006 1:52:29 AM
please help me create the table for the data in the following data lines
after this
i am out of my wits to thing for what data type to use. because for
everything i tried i got the error below the column name will be for the
table i appreciate a lot if someone can help me .
column 1 colu... more >>
Can i bypass a trigger
Posted by Mikael at 3/23/2006 1:48:33 AM
I have 2 tabels "realtime" and "historic"
Im getting updates on "realtime" and a trigger transferes the data to
"historic" if the some dates change.
I've made an sp that can update "realtime" and "historic", and it is more
efficiant than the trigger. I have several applikations that updates ... more >>
Simple SQL syntax question ??
Posted by serge calderara at 3/23/2006 12:55:34 AM
Dear all,
I have a store procedure which has as input parameter @MonthId (integer)
Then in my database table I have a dateTime field. Then I need to exctract
records where the Month part of the DataTime field correspond to @MonthId
parameter.
How to do that ?
regards
serge... more >>
Activity Monitor
Posted by Tlink at 3/23/2006 12:00:00 AM
When I execute a task against my mssql 2005 server it remains visible in the
activity monitor for up to 10 minutes (status = sleeping. open transactions
= 0, command = awaiting command), I have tried and changed the
commandtimeout = 10, reset the connectiontimeout and still it remains. It
ap... more >>
How to list all Triggers with SQL 2005 like sp_tables or sp_databases?
Posted by Andreas Klemt at 3/23/2006 12:00:00 AM
Hello,
how can I list all Triggers like sp_tables or sp_databases?
Thanks for any help in advance!
Regards,
Andreas Klemt
... more >>
Use alias in sql statement
Posted by Jan Lorenz at 3/23/2006 12:00:00 AM
Hi,
It's possible to use a alias name directly in a sql statement?
Example:
SELECT Col1 * Col2 AS alias, alias * Col3 FROM table
best regards
Jan
... more >>
Select statement for finding phone numbers
Posted by Robert Dufour at 3/23/2006 12:00:00 AM
The phone numbers (north american) could be written in the table in several
formats ex. (514) 645-8865 or 1 (450) 658-1788 or 14506532345 etc.
I think the best way to do a lookup is to look for a number that is made up
only of digits, all other characters having been removed, however it is
lik... more >>
Problem with SET QUOTED_IDENTIFIER ON
Posted by AMiha at 3/23/2006 12:00:00 AM
Hi,
I am creating User defined function with
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
But function is created with QUOTED_IDENTIFIER OFF and SET ANSI_NULLS OFF.
What is wrong.
Thanks
... more >>
MS SQL Server 2005 - How to add databases/users/etc.???
Posted by Noozer at 3/23/2006 12:00:00 AM
I've installed the MS VB Express and WebDev Express and subsequently have MS
SQL Server 2005 installed. I'm at a complete loss as to how to access or
configure this server. In the SQL Server configuration I can only see how to
configure the SQL Express protocols.
How can I add users to the ... more >>
OSQL returns error code of 1 - intermittently
Posted by Robert Wheadon at 3/23/2006 12:00:00 AM
Hello,
I've written an program that runs OSQL to set up a database. I got a weird
situation yesterday where OSQL returns an error level of 1 and didn't
generate any output file at all. The command I use is:
OSQL.EXE -E -b -i SetupRTEDatabase.sql -o SetupRTEDatabase.log
Normally, thi... more >>
Scheduled job executing Stored procedures fails
Posted by news.esat.net at 3/23/2006 12:00:00 AM
Hi,
I have 4 seperate stored procedures that if I run manually from Query
Analyzer work fine. Each one picks rows from a number of joined tables
depending on a date criteria. Each SP is exactly the same except for the
date ranges.
When they are run manually they do what I expect and I ... more >>
Could not find database ID 14. Database may not be activated yet or may be in transition.
Posted by ITALstudio S.p.A. at 3/23/2006 12:00:00 AM
Hi,
I have dropped some databases of my application through Enterprise Manager.
Then, I have run my application that try to read a dropped database's table
and I receive
the following error: "Could not find database ID 14. Database may not be
activated yet or may be in transition." Instead, the... more >>
how to format datagrid coloumns header text
Posted by jaffar at 3/23/2006 12:00:00 AM
hi,
i am developing an appllication, in this appllication i am using
datagrid . in this datagrid coloumns header text i want to change coloumn
header text in vertically
it means
datagrid coloum header text is like this
EmapId Name Dept
i need it as ,if we trun it with ... more >>
|