|
hi ,
i am new in mssql2000.
i have table named journal. before inserting dat into it , check that journal no. exist, if exist delete that journal and insert the new one.
is it do with trigger? then how?
with regards
vipin
vipin
|
|
|
|
|
You could do this with a trigger. However, why delete the row? Why not update the existing row with the new data.
Personally, I do this with a stored procedure.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
hello everybody
i'm Tuan, i have just stated with database(SQL server 2000).i hardly knwon anything about database,if anyone who have a small program about database , please send to hepl me to do practice :How to creat database, add in with VB.net with component connection!
Thanks bro!!!
send to me at: anhtuantelecom@yahoo.com
-- modified at 2:54 Sunday 25th December, 2005
|
|
|
|
|
I would suggest that your best course of action would be to get a book on ADO.NET and one SQL Server 2000.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Or take a look around at Code Project. There are numerous articles that can help.
|
|
|
|
|
HOW TO DELETE A RECORDS FROM THE TABLE WHICH HAS THE FIELD SAY CSA WHICH IS NOT A NUMBER.
I.E IT SHOULD RETAIN THE RECORDS WHOSE CSA IS NUMBER???
|
|
|
|
|
use regular expressions to filter your numeric valued records
Any systematic work reflects its significance for a long time, Though I m not totally against "The Prototyping".So let's discuss in depth...
|
|
|
|
|
sorry for the delay, but i cannt sent the r.e. at this time.
well, there is no native support of regular xpressions in MS SQL server 2000
go to this link, http://www.sqlteam.com/item.asp?ItemID=13947
wish u sharp ur skills.
u need pl/sql function to filter numeric valued tuples.
if this is not a problem for always
you can apply this line of query(vb.net or vbscript)
dim sql as string
dim i as integer
dim maxlimit as integer
sql="delete from tblName where tblid not in (select tblid from tblName where csa in ("
for i=0 to maxlimit-1
sql & "'" & cstr(i) &"',"
next
sql & "'" & cstr(maxlimit) &"')"
NOTE: this code is not tested
try this out.
Wish you solve your problem
Any systematic work reflects its significance for a long time, Though I m not totally against "The Prototyping".So let's discuss in depth...
|
|
|
|
|
I have a number representing a month:
DECLARE @MONTH INT
SET @MONTH = 5
How can I use the DATENAME() function to get
the name of the month?
I must have a full date variable to use this
and I don't know how to build a date using
@MONTH as its month...
PLEASE HELP...
|
|
|
|
|
lior654#hotmail.com wrote: How can I use the DATENAME() function to get
the name of the month?
DATENAME() can accept a varchar as the date, so you can just create a random date, with the month as you want:
DECLARE @somedate varchar(20);
SET @somedate = '2005-01-01';
SELECT datename(month,@somedate); This will return "January".
However, I would recommend that user interface type things like getting a month name are best carried out in the UI layer leaving the data layer to get on with things that it is good at (like manipulating the data in the database)
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
My Table has the following structure:
ID Name Description
1 A Desc1
2 A Desc2
3 A Desc3
4 B Desc1
5 B Desc2
The expected output is:
Name D1 D2 D3
A Desc1 Desc2 Desc3
How do i get the above result by SQL Query or Function and not using CURSORS.
Pls. help me out!!!
|
|
|
|
|
i want to create query from two different SQL Server 2000 from two different computer. then how i can access this command. please help me
|
|
|
|
|
If you are going to ask a new question then you should start a new thread!
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
hi,
sorry for the delay
i want to help you, will you like to do some application side programming,
if you format your output in vb,C# etc.
its very easy,
but if you not interested in that, let me know, i can send u later
Any systematic work reflects its significance for a long time, Though I m not totally against "The Prototyping".So let's discuss in depth...
|
|
|
|
|
Is there a free/simple SQL tool somewhere that will help me create a SELECT SQL statement at runtime. I perfer the code to be in C#. I'd like to pass some SQL SELECT parameters and have it return a SQL SELECT string.
Thanks
Steve
|
|
|
|
|
String.Format() ?
I think you may need to explain what you are looking for a bit better because I don't quite understand what you want.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Thank You for repling
A need to "Push" a Crystal report with a DataSet.
The user opens a ADO.Net report selection form. The user makes selections on the form for the MS-Acess database report. I roll his selections into a SQL string (SELECT, FROM, WHERE and ORDER BY). Create the C# DataAdapter and DataSet and send the DataSet to the Crystal report (reportDocument()).
I'm looking for a C# class/method that I can pass the user selections to and it returns a SQL string like "SELECT...". Because I'm a non-profit it has to be free.
Hope this helps.
Steve
|
|
|
|
|
The simplest thing I can think of is not far off the String.Format() thing I flippantly suggested already. It looks like you need some code to build your SQL dynamically and a string builder could be used for that. (Remember that a SQL command is just a string that is sent to the database) There is a command builder for building SQL statements in .NET already, but I've never used it - it may have some useful methods that may help build a SQL statement dynamically without exposing you to the risk of SQL Injection Attacks (something you'd have to manage yourself if you were building the command by concatenating strings).
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Thanks Colin
Two possible choices to evaluate for on-the fly SQL statements
http://www.easyobjects.net
http://www.reebsoftware.com
I think that command builder is for stored SQL procedures. Also, if you have VS do a Help search for SQL Pane - I think its for Access.
If I have to I'll reduce my report requirements and have 3 or 4 SQl templates and insert the parameters in the preformed SQL string.
string s = "SELECT " + field.text + "FROM " + "....";
Building dynamic SQL statement is an excellent choice for a Code Project code sample. Hope all this helps someone.
Thanks
Steve
|
|
|
|
|
Steve45 wrote: string s = "SELECT " + field.text + "FROM " + "....";
Watch out for things like:
field.text == "''; DELETE "
|
|
|
|
|
I've read the documentation and it says the following:
"This type is safe for multithreaded read operations. You must synchronize any write operations."
Would this mean it is unsafe to read and write at the same time?
I basiacly have a process running in the background that can generate an error set. This error willwill then get dropped into a dataview by my back end web page code.
Will this cause problems in my app when an update to the error report on the front end is called at the same time as the process is recording a new one?
Cheers
Tris
-- modified at 8:36 Friday 23rd December, 2005
|
|
|
|
|
Hi,
Following is my table
id name designation
---------------------------
1 Prakash Des1
2 Prakash Des2
3 Prakash Des3
4 Prakash Des4
5 Sathish Des5
6 Sathish Des6
I want the query which should display the data like following format
id name Des1 Des2 Des3 Des4
------------------------------------------
1 Prakash Des1 Des2 Des3 Des4
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
this is a display problem select doesn't return "rows", it returns records. but most of the time, we reprensent them horizontally, because of the ease of the view.
if you want to display such a thing, you'll have to make the "decomposition" in the displaying job.
[edit]
will that timorous anonymous guy who vote this to '1' ever show off one day...
i persist thinking what i wrote is what to do, and if anybody counter say this, he'll always stay in the dark side of Codeproject, where people act anonymously.
[/edit]
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 8:07 Friday 23rd December, 2005
|
|
|
|
|
Hi,
Can you guide me how to make a decomposition
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
well, i don't know how you display your data, but here are the hints.
when you get the set of records from SELECT, you then know the number of records returned.
then you can extend your grid depending on that.
but i cannot say more, as i don't know which language you're using, nor your database schema...
but i hope you see the job to do...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|