all groups > sql server programming > february 2006 > threads for friday february 10
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
Find specific text in a string
Posted by ksrajalakshmi NO[at]SPAM gmail.com at 2/10/2006 11:28:04 PM
Hai ,
in a textbox am having text as
"(20/100)+pay1*pay2" .it's a formula. and stored in a particular
variable.
string strformula="(20/100)+pay1*pay2" ;
i've to substitute the value of the variable 'pay1' & 'pay2' and
finding the value of that strformula.
can any onr tell me how to find ... more >>
Need help constructing Full Names
Posted by Sam at 2/10/2006 10:50:26 PM
Hi,
I have three fields that make up employees' names in the database i.e.
FirstName, MiddleInitial and LastName fields. FirstName and LastName fields
are varchar(30) and varchar(50) respectively. MiddleInitial field is char(1).
When I use the FirstName + ' ' + MiddleInitial + ' ' + LastNa... more >>
big task?
Posted by JY at 2/10/2006 9:31:09 PM
i have a table with 3 columns:
duration (int)
startdatetime (bigint)
userid (int)
i want to get that row's startdatetime where sum of duration becomes equal
to or greater than 1000.
how can i do that? i can only think of a cursor solution.
Thanks
... more >>
Having trouble w/ Decimal field
Posted by Sam at 2/10/2006 8:56:02 PM
Hi,
I have a decimal field with precision 3 and scale 1. This field will have
values ranging from 0.5 to 10.
When enter new values into the table using the following stored procedure,
my decimal values get rounded up. If I enter values directly into the table,
everything is fine. Do I ne... more >>
select for output columns from table and local file as image.
Posted by hazz at 2/10/2006 8:36:44 PM
I would like to use a select statement that selects various columns from a
database table but also contains as the output of the select statement an
image datatype which has been set to the value of a bitmap btained from a
local file at location c://
How would I do that?
Thank you.
-hazz ... more >>
insert a .bmp or .ico file into a database table image column
Posted by hazz at 2/10/2006 7:20:53 PM
how do I do that? thanks. -hazz
... more >>
Deleting primary key when no foreign records exist?
Posted by CJ at 2/10/2006 6:35:47 PM
Is there a trigger that would handle this situation? I have a 1 to
many between two tables and would like the primary key deleted if the
last foreign record is deleted.
Thanks in advance!
... more >>
creating image column on the fly based on another column's varchar values.
Posted by hazz at 2/10/2006 6:31:59 PM
In a datagridview databinding scenario, I would like to replace a
datagridview column's text values with an icon for a better user experience.
The problem is that if I select the column value from my table of datatype
varchar, that datagridview column value cannot be changed from a textbox
c... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
problem with DBLib access to SQL Server 2005
Posted by Balt at 2/10/2006 5:21:27 PM
Hi all,
I'm having a (probably) fundamental problem executing an insert statement on
SQL Server 2005 from an app written in plain C, using the DBLib API. Please
DO NOT comment on the fact the DBlib is obsolete, I know it is. It's just the
fastest way with the least overhead, and as such my ... more >>
UPDATE ...
Posted by Petteri at 2/10/2006 5:04:02 PM
Any idea?
column "TEST"
data of column TEST [data123], [data234], [test111], [test321], [data456]
How can I replace part "test" to "data" by simple sql-command?
... more >>
Storing Time Only
Posted by Mark Moss at 2/10/2006 4:43:09 PM
Ladies / Gentlemen
I need to be able to store only the 'Time' that an event happens not
the 'DateTime' how can this be done? I need to make sure that 'Dates' do
not come into play as I will be doing queries such as this.
Select *
Where StartTime <= Convert(DateT... more >>
Can not connect to SQL 2005
Posted by Michael Tissington at 2/10/2006 4:40:26 PM
I have SQL 2005 installed on a server.
The client is trying to connect to the server, I can create an ODBC
connection but when when software tries to connect using ADO I get the
following error
"To connect to this server you must use SQL Server Management Studio"
What do I need to ins... more >>
BUG - ISNUMERIC('.') = 1
Posted by Howard Swope at 2/10/2006 4:36:54 PM
ISNUMERIC('.') returns a value of 1.
This is bad, right?
Howard
... more >>
Table column tied to a user defined function (UDF)
Posted by Geoff Pennington at 2/10/2006 3:50:49 PM
A column (call it Pcolumn) in the parent table should equal the sum of
[crProcAmount] from several rows in the child table. So, in Design Table, we
set the formula property for Pcolumn to the user-defined function
([dbo].[udfBudgetAdjustment]([pkID])) where pkID is the primary key in the
par... more >>
How to improve query
Posted by nashak NO[at]SPAM hotmail.com at 2/10/2006 2:59:15 PM
Following is a query based on Northwind. I need to output the highest
order value for each date.
The following works. However I want to see if there is any way to
remove the nested query and do some joins.
select a.orderid, a.orderdate, sum(b.quantity * b.unitprice) as total
from orders a, ... more >>
T-SQL Puzzle, well to me at least...
Posted by Josh Crosby at 2/10/2006 2:50:36 PM
Hello, I was asked by the finance dept. to come up with a solution to produce
a report for them for tax area... anyway here's the probelm
have a table 3 columns (invoicenumber, total sale, tax)
so i have data that looks a bit like this
1 $200 $1.75
1 $200 $4.00
1 $200 $3.00
2 $400 $0.99
... more >>
multiple parameters for user defined function
Posted by AkAlan at 2/10/2006 2:26:36 PM
I have a udf with a single parameter @Status which I use to return records
based on a status of Red, Amber, Green, or ALL(DEFAULT). It works great but I
want to be able to return records that are either Red or Amber. I have tried
entering values to the function when it prompts me a number of d... more >>
Drop & Create sProc
Posted by Marc Miller at 2/10/2006 1:38:43 PM
I generated SQL Script to drop and recreate some tables in my database
that I will want to perform monthly. I would like to put the script into a
sproc, however when I try to compile it I receive an error that the tables
and indexes already exist in my database.
Is there any way around this o... more >>
Access Denied -- txt file on other server
Posted by Art at 2/10/2006 1:36:26 PM
Hi and Help!!
I'm using Bulk Insert to read a text file that is on a different server. I
get an access denied message.
- If I change the name to a non-existant file,
I get an error that it can't find that file, so it can see it.
- I can successfully read a copy that I stored on th... more >>
SQL2005: Linked Servers & Updating Text datatypes
Posted by Rob Morhaime at 2/10/2006 12:42:28 PM
This bugged me in SQL2000 and seems to still be here in SQL2005. Here's repro
code to run on two SQL2005 servers:
Run this on the "remote server":
Create Table RemoteTable (id int, txtdatacolumn text)
Insert RemoteTable
Values (1, 'remote')
And run this on the "local server":
EXEC sp... more >>
Problem with Intead of Insert Trigger
Posted by Brian Levine at 2/10/2006 11:48:11 AM
I'm having a rather weird problem with an Instead Of Insert trigger.
Its supposed to check to see if the record exists in the destination table,
and if so update it, otherwise insert the row in the table. All pretty
straightforward, but I'm getting weird behavior.
If the destination table... more >>
Why is this statement blocking...
Posted by bigcoops at 2/10/2006 11:17:31 AM
when running the following statement with CDatabase.ExecuteSQL:
"update TABLE set COLUMN1=STRING1,COLUMN2=STRING2 where
COLUMN3=STRING3"
A little background...
This statement is ran by clients when connected to the database. The
database is running on a machine where there is manager/monit... more >>
Script runs 'forever' and creates huge .LDF
Posted by Sydney Lotterby at 2/10/2006 11:12:05 AM
SQL 2K w/latest SPS, Win2K Adv Server 2gb RAM, dual-core AMD CPU 3400, 80gb
free on drive
There are ~ 9 Million rows in table __ACS and there should be < 100,000 rows
inserted into __ACSmaster.
There are indexes on each of the columns in the Group By - though I suspect
they have no effect ... more >>
Copying records
Posted by dew at 2/10/2006 10:17:26 AM
How would I copy x amount of records, at the same time changing one of the
fields?
I can't copy the records as is, because of unique constraints, and I can't
leave the field that needs to be changed blank, also because nulls are not
allowed. So how would I do it in one swoop?
... more >>
Schema differencing tool?
Posted by Robert Davis at 2/10/2006 10:14:33 AM
Can I get your recommendations on the best schema differencing tool to be
had?
TIA!
Robert
... more >>
Guaranteed consecutive identity values
Posted by Michael Abraham at 2/10/2006 9:48:24 AM
If I do a INSERT INTO <table> SELECT ... and <table> has an identity column
with an increment equal to 1, does SQL/Server 2000 and/or SQL/Server 2005
guarantee that the identity values generated for a single successful INSERT
of this type will be consecutive. So if I do an INSERT INTO ... SEL... more >>
BCP output - putting double quotes around text
Posted by mgale1 at 2/10/2006 9:38:30 AM
Folks,
How can I program BCP to output text items in double quotes (")?
Here is an example (please try it) that trys to output some columns from a
table to csv file. However, due to the existence of commas within the
fields, the comma separation gets messed up.
--------------------------... more >>
Read autonumbering field from db
Posted by Jensgjerloev at 2/10/2006 9:02:30 AM
Situation: We are blank new to SQL server (previosuly access) and we need to
convert to sql server quickly. Consequently this is maybe not a very wice
question - but it is SO important to us :-)
**
this works in access - but not on sql server:
Tabel contains 2 fields:
id = autonumbering
t... more >>
Colour My World
Posted by Joel at 2/10/2006 8:51:29 AM
In SQL Server 2000 Query Analyzer, is there a way to print T-SQL code with
the QA color coding? When I print, even to a color laser printer, everything
including the keywords and comments come out in black and white.
Thanks!... more >>
NESTED SQL QUESTION and aggregate function
Posted by kaczmar2 NO[at]SPAM hotmail.com at 2/10/2006 8:47:48 AM
I have have three tables that I need to pull information from, and
return selected rows. Sorry for the psudeo-code for the tables, but it
should give you an idea of their (simplified) structure:
Inspections (
InspectionID int (PK),
LocationID int (FK),
InspectorID int (FK),
Inspect... more >>
Delete files
Posted by Ray at 2/10/2006 8:46:38 AM
What is the SQL equivalent of the following VBA? Am very new to SQL
programming
Kill "C:\Documents and Settings\Ray\Desktop\TestExtract.txt"... more >>
Query Help - Counting Dates and Times
Posted by tarheels4025 at 2/10/2006 8:03:29 AM
I was wondering how to write a query to count the following date and times.
Any help would be appreciated.
This is from a table sv_call_log
I am using a column called start_date
The column start_date is formatted
start_date
-------------------... more >>
Need help setting up linked server
Posted by jmelkerson at 2/10/2006 8:03:28 AM
I cannot for the life of me set up a linked server. I am trying to do what I
think must be the simplest, easiest linked server set up there is: Link an
instance of SQL Server 2000 to another instance of SQL Server 2000. I've
read everything I can find in BOL, on the web, in my sys Admin book... more >>
Removing duplicate data
Posted by Andy at 2/10/2006 6:34:27 AM
I have a table that I need to remove duplicates from and the table includes
an identity column. The table contains 12 fields but our business rules are
that only 3 of the fields can make the record a duplicate. We would like to
keep the record with the min identity column. I have done this ... more >>
BCP or BULK INSERT, which one is better to use.
Posted by Manoj at 2/10/2006 6:24:38 AM
Hi,
I have some data in ANSI txt file, i want to know which one would be
better and recommended way to import this into table. bcp or BULK
INSERT
Appreciate your inputs on this.
Thanks,
Manoj
... more >>
Renaming the server name? How could I do such thing?
Posted by Enric at 2/10/2006 5:43:26 AM
Dear all,
I would need to rename the name of the server.
any comments will be welcomed.
--
current location: alicante (es)... more >>
CLR Triggers and inserted table
Posted by Dr. Paul Caesar - CoullByte (UK) Limited at 2/10/2006 4:55:27 AM
I have created a CLR trigger that validates an address that has been enetered
into our address database does not already exist and that it meets country
critera for addressing.
I have a RowVersion column (timestamp), I use this to determin if any
changes have been made to a record in the ta... more >>
Create table using data from another table
Posted by sabi at 2/10/2006 4:46:16 AM
Hi,
How could I create a new table dynamically where columns names are data
from another table?
Example:
I have a table "Table1" with one column "T1Col"
The column contains following data:
"Row1"
"Row2"
"Row3"
Now I would like to "read" data from Table1 and create a new table
Table2 wh... more >>
Select query
Posted by Senna at 2/10/2006 4:06:27 AM
Hi
CREATE TABLE [Table1] (
[Id] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[Title] [varchar] (50) NULL ,
CONSTRAINT [PK_Temp_Table1] PRIMARY KEY CLUSTERED
(
[Id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [Table2] (
[Id] [int] IDENTITY (1, 1) NOT FOR REPLICAT... more >>
Help with smalldateTime
Posted by Pumkin at 2/10/2006 3:18:42 AM
Hello everyone,
I have in a table a field smalldatetime. The problem is that when I
select from table I need only the date without the time.
Is it possible not to show the time?
For example 06/02/2006 00:00:00 to be 06/02/2006.
Thanks a lot
... more >>
Switch between TRANSACTIONS
Posted by Roby Eisenbraun Martins at 2/10/2006 2:45:20 AM
Hi,
I'm Roby Eisenbraun Martins. I'm a C++, VB, C# as ASP .NET developer.
I'm creating a number of transactions one after another. Right now I
always worked with the last transaction created. But somethings I need to add
code in another transaction. Is it possible so switch back ... more >>
Performance Update versus Update using table variable
Posted by LeBaron at 2/10/2006 1:44:29 AM
I am looking for a explanation on the following:
I have the following code (on a dataset of 1 million rows). It runs very
efficiently:
----
declare @tussentabel table (contractnummer nvarchar(25), positienummer
nvarchar(25), messagetime datetime, ean nvarchar(30))
insert into @tussenta... more >>
Concatenating:www.aspfaq.com/show.asp?id=2529 Is the glass half full or half empty or..?
Posted by 05ponyGT at 2/10/2006 12:59:36 AM
Lately there seems to be quite a few posts regarding the
concatenating of column data in sql.Faq2559,written by a very
knowledgable MVP,is often cited as a reference for this
problem's solution.This problem is interesting as it has
spurred debate on a number of issues including client vs. server... more >>
SQL script, split digits and letters
Posted by P. Garcia at 2/10/2006 12:00:00 AM
Hi folks!
I have a small problem i'd like to solve:
Say i have 2 columns, both are nvarchar(20). the first one contains license
plates. I'd like to update the second column to contain the same as the
first, but with a space between letters and digits or viceversa.
examples:
col1: S XX1... more >>
wtf - sorting table doesnt work????
Posted by Eric at 2/10/2006 12:00:00 AM
Hi!
I have a table I'm trying to sort a table from a stored procedure but no. If
I do it from Query Analyzer it works fine, but when I try the same thing
from the stored procedure it just refuse to sort. Any ideas? Collation?
Anything else? Quite irritating... :/
/e
... more >>
Disconnect Client Connection via T-SQL/Store Proce
Posted by Curtis Kam at 2/10/2006 12:00:00 AM
Hi Gents,
If there are some client connections on the database and I would like to
detach the file, it's failed when execute the store proc "sp_detach_db". Any
SQL statement or Store Procedure on clearing/kicking out the current client
connections? Thanks in advance.
Regards,
CurtisL
... more >>
Query Analyser
Posted by Robert Bravery at 2/10/2006 12:00:00 AM
HI all,
Where can I read up on how to use query analyser to optimise queries and SP
etc.
Thanks
Robert
... more >>
Help with UDF
Posted by jp at 2/10/2006 12:00:00 AM
Hi,
I've not created one of these before so if anyone can help me get this up
and running that would be great. I want to write a function to obtain the
exchange rate from a table based on three parameters - exhange rate, country
& year.
The complication I have is I want to pass in the va... more >>
Best practice datatypes
Posted by Robert Bravery at 2/10/2006 12:00:00 AM
HI all,
Which ould be the best datatype to use. I have possibilities of monetory
values from 0 to 1000000000
I've heard that the money datatype is not readily used. Should I use
numeric. What do you guys use
Thanks
Robert
... more >>
|