|
minkinin wrote: pls guys pls I need a C# code to do that
C# code does not alter the database, the best it can do is to forward some SQL code to the database. You need SQL code to solve your problem.
The SQL you need is something like this:
UPDATE MyTable SET [expiry date] = dateadd(year, [latest date]);
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Thanks a lot Colin,this is exactly what I wanted
and is working perfect;P
|
|
|
|
|
I have in the distant past been able to debug SQL Stored procedures in the .NET ide, and now I have not been able to figure out the correct configuration. If anyone has this knowledge please give me and a multitude of others an hand with this very helpful tool. Thanks in advance for your help.
SL
|
|
|
|
|
You have to enable SP-Debugging in the .net-project.
'A programmer is just a tool which converts caffeine into code'
|
|
|
|
|
Hi i am havin a bit of trouble tryin to get a match based on a null value in a table, there are 4 tables based on the id that is on the bottom table which is null in some of them, i use dif ids to get to the top table and use the namethat is in there this is the code i am using i am just wondering ifanyone has any ideas of how to work around this problem
select ssg.Name + ' ' + supt.Name + ' ' + st.Name as name, st.name as '4th', supt.name as '3rd', ssg.name as '2nd', sg.name as '1st'
from session s
left join sessionActivity sa on sa.SessionId = s.Id
left join SessionType as st on st.ID = sa.SessionType
left join SessionSuperType as supt on supt.ID = st.SuperTypeId
left join SessionSubGroup as ssg on ssg.ID = supt.SessionSubGroupId
left join SessionGroup as sg on sg.ID = ssg.SessionGroupId
where sg.Id <> 8
and sg.Id <> 9
and s.ID = 50
|
|
|
|
|
how can i perform multiple update in one trip to the server
love you all
|
|
|
|
|
Put multiple statements in the SqlCommand .
For example:
INSERT INTO MyTable(a,b,c) VALUES (@a1, @b1, @c1);
INSERT INTO MyTable(a,b,c) VALUES(@a2, @b2, @c2); Just separate the statements with a semi-colon.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
-- modified at 8:03 Tuesday 17th January, 2006
|
|
|
|
|
Hello. I would like to call a function that retrieves the table name. and then use the name in a statement. like this:
UPDATE GetTableName() SET bla bla... and so on
Is this possible? I return the tableName as a VARCHAR, but this does not seem to work.
All help is appreciated, thanks!
/Joel
|
|
|
|
|
u can find the table name by the following:
select name from sysobjects where type='u' and name='tablename'
then u can set in ur update code
abhinav
|
|
|
|
|
HOW CAN I DO MULTIPLE UPDATE IN ONE TRIP TO THE SERVER
LOVE U ALL
|
|
|
|
|
Yes.
And, by the way, do you know your caps lock key is broken?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
i have a problem on adding a where clause on my excel sql statement this is my excel detail
abc company
ppa_codes amount
ab 2500
cd 2300
i only want to select the rows starting with ppa codes upto cd.
what are the possible statement that i can use?
i am using "select * from sheet1$" but it includes the abc company and the null value next to it. what are the possible columns that i'm going to use on my where clause, for example "select * from sheet1$ where ___"
thanks in advance tahnk you again
september
|
|
|
|
|
To write something you have to know more about your values being a string. If the alpha characters range is "aa" thru "zz" also if the numbers part of the string "0000" thru "9999" and if between them the value does not matter. Then I could write you something.
Bob Zagars
|
|
|
|
|
There is one thing I can't figure out with VC 6.0 & ADO. How can I change the 'Background Fetch Size' (DBPROP_ASYNCFETCHSIZE) property of the recordset running asynchron? It's the number of records retrieved between two fetchprogress events. It's default is 15.
It's easy to do it in VB, but in VC++ before opening the recordset, I don't have any dynamic properties available, after executing the SQL the property is read only. I suppose if it's possible in VB it must be possible in VC++ 6.00 as well. I've hard times finding any docs about it even in SDK. As far as I know this OLEDB property is supported by the Cursor Service, which is initilaized when changing cursor to adUseClient.
Any idea?
|
|
|
|
|
Hai
How can i export data in SQLServer 2005 Tables as SQL insert Script. Is there any free utility for this purspose.
Regards,
|
|
|
|
|
anig1234 wrote: How can i export data in SQLServer 2005 Tables as SQL insert Script.
What I do is have my SELECT statement output the appropriate script
SELECT 'INSERT INTO MyTable(Column1, Column2, Column3) '+
'VALUES('+Column1+','+Column2+','+Column3+');'
FROM MyTable
Then I can copy the script out of the query analyzer into a text file (actually you can have the query analyser write it directly to a file, but you have edit it afterwards to remove the other bits and pieces it writes out)
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
|
I'm not sure if i should have posted this in the asp.net forum or not but it's mostly a database sort of a question.
I've been tasked at work to write a library that will parse a tab delimited text file and filter the data and stuff it into a normalized sql server database.
basically the text file is a straight textdump from the clients main offices product database and the sql server database the info's being entered into is for their website to pull from for their online catalog.
now to make my life easier i set up a dsn using microfts text/csv ODBC driver the actualy library is done and works beautifuly. my problem (and it might not even be a problem) is that i'm confused on how to distribute the dsn that loads the textfiles.
basically i need to set the dsn to point to the "dump" folder on their website's server so that when they upload a new copy of the file the library knows where to find it to pull the information from right now the dsn is just a user one pointing to a logical disk file on my home computers desktop (i do alot of my testing at home)
sorry if this is a little simple of a question i deal more with sql server and straight connection strings and for some reason the dsn thing just confusses the hell out of me
thanks for the help
guys and gals
Ryan
|
|
|
|
|
http://support.microsoft.com/kb/q165866/
|
|
|
|
|
i need to create a query but i don't want to make it using View mode or wizard, but just as in SQL server inserting a SQL text query and run.
Is it possible?
|
|
|
|
|
All you have to do is create a new query then click the View menu, then SQL.
Type away...
Keep in mind that Access doesn't support batch queries like SQL Server does.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I am a beginner, and my questions are: what is the function of a schema xsd in a solution with access to a database?
What can I do with a data set created starting from xsd file?
Thanks a lot
Bye
AlbePes
|
|
|
|
|
The following question:
A user enters the name of a horse
The program then checks for this name in a FEI table file
If found the rest of the data must be entered and the total are written to a table called Horses and the resulting ID to a third file to connect a rider afterwards.
Is it possible to check in the SQL command if the the is on the first table and if the result is true check the other database and is that result is tru return the ID in that second Table, something like
IF(SELECT Horse_name, Horse_FEI From FEI WHERE Horse_Name LIKE inputName%)=True Then
IF(SELECT IDHorse From Boekelo_Horses WHERE Horse_ID = FEI.Horse_FEI)= True Then
Get all data and show edit screen
END IF
END IF
|
|
|
|
|
gharry wrote: IF(SELECT Horse_name, Horse_FEI From FEI WHERE Horse_Name LIKE inputName%)=True Then
IF(SELECT IDHorse From Boekelo_Horses WHERE Horse_ID = FEI.Horse_FEI)= True Then
Get all data and show edit screen
END IF
END IF
The structure you are looking for is something like this:
IF EXISTS(SELECT * FROM FEI
INNER JOIN Boekelo_Horses AS bh ON bh.Horse_ID = FEI.Horse_FEI
WHERE Horse_Name LIKE @inputName)
BEGIN
SELECT 1;
END
ELSE
BEGIN
SELECT 0;
END
You can then call this SqlCommand with ExecuteScalar() and it will return a 1 for true, and 0 for false. Your calling application can then decide to take appropriate action depending on the outcome.
I've also taken your two SQL statements and rolled them in to one as they were disjointed, the second IF statement seemed to need input from the first that it was never going to get.
In a IF EXISTS(SELECT ....) structure, the list of columns in SELECT is ignored so you don't need to specify them, and specifying * is about the only time it is not inefficient to do that as the Query Optimiser already knows it needs no fields, it is just looking for one row with any data before it will stop processing the statement.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Can someone help me? I can get a list of NT groups (xp_enumgroups) but how do I get a list of NT users not autorized yet for the database?
Bob Zagars
Senior Software Engineer
|
|
|
|