|
Hi ALL,
How to find 4th working day(any for tht matter) of
any month...If for ex. For June 2006, the 4th working day is
6th June. So, i need to write a PL/SQL(or even SQL Query is also fine) to obtain tht particular day.
Plz do the needful.
Regs,
Jazzy
|
|
|
|
|
|
Hi,
Im trying to get the records from excel sheet to sql server table.
pls help me..getting some errors..
--------------------------------------------
@file_name varchar(255)
as
begin
--select @file_name = DOCUMENT_PATH from DOCUMENT
SELECT @file_name =(' \\ZSW125\AON\BatchProcessing;HDR=YES ')
--Get the excel filename & path to be imported from the reference table
declare @strsql varchar(500)
set @strsql = 'select * from openrowset(''Microsoft.Jet.OLEDB.4.0'',
''Excel 8.0;Database=' + @file_name + ';HDR=YES'', ''"
select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database='\\ZSW125\AON\BatchProcessing;HDR=YES','')
|
|
|
|
|
Hi,
Please anyone can help me for finding a word from a particular field from table in database of SQL.
I have the problem below.
DataTable Name: TempTable
Field name: Dtail
other field name: KeyWords
in the Detail field i have data like:
<--Begin-->
(TenderProcess <> 'Sell' and (State in ('Gujarat') and (ProductName in ('Iso-9002 Consultancy','Audit') or ProductDetails like '% ISO %' or ProductDetails like '% ISO- %' or ProductDetails like '% ISO - %')))
<--End-->
Above is the data in field of Detail Now my Question is:
I want to get words if it found the word 'Product Detail like%%'in any record.
Then for above ex. if I found the word it give
output:ISO,ISO-,ISO -
------------------------------------------------------------
So from above ex. I how I get the output as above.
Please help me.Reply me urgently.
Jesal
OK
|
|
|
|
|
|
I originally developed my application using SQL 2005 Developer Edition, but want to switch to using an XCOPY deployed DB on SQL Express for deployement.
I have successfully copied the database.mdf/ldf files over to me project, and can connect using Data Source=.\SQLExpress and AttachDbFilename=|DataDirectory|\[database].mdf attributes.
The question is, how do I enable CLR integration for my C# SP's?
I've tried executing the following in various places:
sp_configure 'clr enabled', 1
go
reconfigure
go
But I obviously haven't hit the spot because I'm getting the following error when VS deploys my SP library:
Error: starting database upload transaction failed.
Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Any ideas?
|
|
|
|
|
I have an existing SQL table with no constraints. The PartID and DescriptionPartID need to be a composite key. I check and there are currently no duplicates in the existing table. Can I create the key now by doing the following:
UPDATE TABLE Descriptions
PRIMARY KEY (PartID, DescriptionPartID)
Thanks!
|
|
|
|
|
|
As always, Thanks man!
|
|
|
|
|
|
hi guys
how should I load a whole database into a Dataset object.
when loading from a DataAdapter i should use an SQL command. what if i want to load all tabless and reltions and ... in a Dataset?
i want to make a program to load all sort of databases (even without knowing the name of the tables)
thx guys
|
|
|
|
|
hamidreza_buddy wrote: how should I load a whole database into a Dataset object.
Hopefully it is a small database. The last database I worked on was 150Gb when I left the project and growing at roughly 1Gb per week. That would never have fit in a DataSet.
The other question is: Why would you want to?
hamidreza_buddy wrote: when loading from a DataAdapter i should use an SQL command. what if i want to load all tabless and reltions and ... in a Dataset?
Your SqlCommand would consist of:
SELECT * FROM TableA; SELECT * FROM TableB; SELECT * FROM TableC; -- etc...
hamidreza_buddy wrote: i want to make a program to load all sort of databases (even without knowing the name of the tables)
You need to know the names of the tables to put in the SqlCommand . However, you can get this information:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
-- modified at 7:02 Friday 30th June, 2006
|
|
|
|
|
thx
we want to make a Data Mining Application.
unfortunately i am a newbee in databases and i dont know the strategies for making such an application.
i really need ur suggestions.
how should i do proccess on databases.
* should i store them in a DataSet or DataReader or what?
as i said it should load every database without knowing name of tables.
waiting for ur strategies.
thx again
|
|
|
|
|
hamidreza_buddy wrote: we want to make a Data Mining Application.
Then leave the data in the database and only ever get what you need at that moment.
Data mining applications usually deal with vast quantities of data, much more than the RAM+swap space of a server, let alone a regular desktop.
Database engines are optimised to do vastly complex "set based" calculations on the data in a database. A DataSet can manage only small fraction of this. DataSets a bebeficial when a small amount of data is repeatedly queried - in this case the performance of the dataset out weighs the round trip cost of performing the query on the server.
Set based operations are those which involve multiple rows of data (a set of data). They are expecially good at joining sets of data together. (If you want to delve really deep into this area they you might like to read up on set theory in mathematics)
hamidreza_buddy wrote: how should i do proccess on databases
Let the database do the work and you pull across only the answers.
hamidreza_buddy wrote: should i store them in a DataSet or DataReader or what?
A DataReader is not a storage mechanism. A DataReader is a mechanism for reading data (hence the name DataReader) from a database.
I, personally, don't like DataSets because they are bulky and I can get better results by creating my own business objects. In .NET 2.0 the typed datasets are supposed to be much better, but I've not yet looked at them.
hamidreza_buddy wrote: i said it should load every database without knowing name of tables.
I already gave you the query you should use to obtain a list of table names. You need to know the name of the table in order to refer to it.
hamidreza_buddy wrote: waiting for ur strategies
I have a pathological hatred for the use or "ur" the word is "your". The same goes for "thx" - THX is a sound quality assurance system that means that if you see a movie in a THX certified theater it will sound exactly as it did in the mixing studio.
On the subject of strategies - There are lots out there, but for a data mining application I don't thing a DataSet will feature much for the mining aspect. Maybe only for helping you bind data to the controls (should you wish to go that route)
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
Hi,
Please any one can help me for how I find a word from a paricular field from database in SQL
Please reply urgently.
Regards,
Jesal Rana
OK
|
|
|
|
|
select a from table where a like '%word%'
Or set up a full text index and use the CONTAINS predicate.
|
|
|
|
|
Hi My one column field is something like
1.1.1.1
please note it can be any number between 1 to 1000 before each .
e.g. upto 1000.1000.1000.1000
1. my question is how can i extract,
anything that starts before second '.' and insert into another column with in a same record.
2. how can i extract any number that starts after second '.' and before third '.'
please provide me clear direction
cheers.
|
|
|
|
|
|
hi,
try this out ...
I am giving you the code to fragment the column field as you have described.
Try the code with diffrent strings like '1.1.1.1' ,'1.891.91.21' etc.
I am taking '1000.087.1567.7956' as example.
<----------------------------------->
DECLARE @vStr AS VARCHAR(100);
SET @vStr='1000.087.1567.7956'
--first no.
SELECT SUBSTRING(@vStr,1,CHARINDEX('.', @vStr) - 1)as A
--second no.
SELECT SUBSTRING(@vStr, CHARINDEX('.', @vStr)+1 ,CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )-(CHARINDEX('.', @vStr)+1)) as B
--third no.
SELECT SUBSTRING(@vStr,CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )+1 ,CHARINDEX('.',@vStr,CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )+1)- (CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )+1)) as C
--fourth no.
SELECT SUBSTRING(@vStr,CHARINDEX('.',@vStr,CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )+1)+1,LEN(@vStr)+1-(CHARINDEX('.',@vStr,CHARINDEX('.',@vStr,CHARINDEX('.', @vStr)+1 )+1)+1)) as D
<-------------------------------->
kindly do feel free to ask if you have doubt about it.....
vivek
delhi
vivek
|
|
|
|
|
To back Colin's comments up - we wrote and support a system where it was originally not anticipated that the parts of a certain identifier (carton number, IIRC) would need to be queried for a certain table. A changed requirement made this necessary. The substring operations make it impossible for SQL Server to use an index, so every row must be accessed, which you almost never want to happen unless your table is very small.
Further, something about the query sometimes causes SQL Server to pick a poor execution plan which takes an unacceptable amount of time to complete. Often running sp_updatestats fixes the problem, but I think this is simply because it forces the query to be recompiled.
We're looking at adding extra columns to sort this out.
In terms of what you need to do - preprocess your data before insertion. Almost any client-side language (C#, VB.NET, etc) is far better at string manipulation than SQL is. If you already have data that's in the format you've shown, then doing a one-time update is acceptable.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I'm building an application that uses ODBC. I'm using SQL Server 2005 Express for my test bed, but I would like to be portable to the customer's DBMS if possible.
What are the 'best practices' for creating an empty data base?
Based on what I've read, I'm guessing that, since data base creation is a privileged activity, that I will have to have the user create the data base manually. I'm thinking that, at that point, my application could go ahead and create the empty tables if they aren't present when I open the data base.
The alternative would be to have some kind of SQL script run by the installer to create the empty tables.
Anyone have recommendations or suggestions?
Software Zen: delete this;
|
|
|
|
|
Create a SQL script that can create db and then create all tables etc.
In 2005 Express. Right Click your db -> Tasks -> Generate Scripts...
This will take you to the script Wizard where you can script your entire database.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
Thanks for the response.
Frank Kerrigan wrote: In 2005 Express. Right Click your db -> Tasks -> Generate Scripts...
Yeah, I've got that, and will use it for the 'default' installation case where I'm installing SQL Server 2005 Express.
I would like to provide a 'sanitized' version of that script for creating the data base under other DBMS's (like Oracle, MySQL, etc.). I've not found anything specific on MSDN that describes which parts of their script are not ANSI-SQL, which seems to be a sort of a common denominator.
Software Zen: delete this;
|
|
|
|
|
I need to analyze one of the column values during an insert action, alter it and have it insert into the database and I figure an Instead of trigger is the best way to go. But, the table structure that my instead of trigger is on can change so I do not want to hard-code the column names in my trigger. How do I select from inserted and loop through the columns so that I can create another insert statement with those column names and values?
|
|
|
|
|
Okay, this is a question for a coworker.
Table A has two fields: partNumber, weight
Table B has two fields: partNumber weight
Table A has about 1000 records, table B has about 10,000 records.
Table A has the most recent information about weight. What he wants to do is if the part number in table A also exists in table B, update that weight with the weight from table A. (If the part number exists in table b, the weight is outdated.)
How can we do this in sql?
Thanks all!
|
|
|
|
|