Modify The SQL Of A SQLDatasource
Apr 5, 2006
When you first come into the web page I want to exam the querystring and the modify the SQL Statement accordingly in a SQLDatasource.
What is the right event of the SQLDataSource to modify the
SQLDataSource.SelectCommand = MySQLString property?
Thanks
View 3 Replies
ADVERTISEMENT
Jul 23, 2007
What is the C# code I use to do this?
I'm guessing it should be fairly simple, as there is only one row selected. I just need to pull out a specific field from that row and then insert that value into a different SqlDataSource.
View 7 Replies
View Related
Mar 8, 2007
i am using visual web developer 2005 with SQL Express 2005 with VB as the code behindi have one database and three tables in itfor manipulating each table i am using separate SqlDataSource() is it sufficient to use one SqlDataSource() for manipulating all the three tables ? i am manipulating all the tables in the same page only please help me
View 1 Replies
View Related
Jan 15, 2008
Is there a way to allow non-sysadmin to modify jobs they don't own from the management studio interface?
Even the most privileged SQLAgentOperatorRole does not allow this...
Thanks
View 10 Replies
View Related
Oct 22, 2007
The following was not written by me but I need to modify it and I am definitely no expert in SQL. It returns a list of files that a user is allowed to access based on whether or not they belong to a specific user group and that group has been granted access to the file.
Here is the SQL as it is currently:
SELECT a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, u.UserName, a.UserID, COUNT(ga.AnswerFileID) AS ShareCount
FROM
User AS u INNER JOIN
AnswerFile AS a LEFT OUTER JOIN
GroupAnswerFile AS ga LEFT OUTER JOIN
GroupUser AS gu
ON ga.GroupID = gu.GroupID ON a.ID = ga.AnswerFileID ON u.ID = a.UserID
GROUP BY a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, a.UserID, u.UserName, gu.UserID
HAVING (gu.UserID = 2)
UNION
SELECT a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, u.UserName, a.UserID, 0 AS ShareCount
FROM AnswerFile AS a INNER JOIN User AS u ON a.UserID = u.ID
WHERE (a.UserID = 2) AND (a.ID NOT IN SELECT AnswerFileID FROM GroupAnswerFile))
I need to modify this code to add an additional check. I have added a file that allows specific users to be granted access to files. It is called AnswerFileUser and contains AnswerFileID (the file) and UserID (the user that has been given access). I need the query to return as part of the results those files where a user has been given access regardless of their group or group access. I hope this all makes sense. Thanks for your help!
Oops - this is SQL 2005...
View 1 Replies
View Related
Jan 2, 2007
give me answer and what's the difference between view and stored procedure
View 2 Replies
View Related
May 18, 2007
How do you change the time out value for a specific connection? I'm having problems when I connect to SQL Server from my website and I want to test if this would help.
View 2 Replies
View Related
Jun 18, 2007
How do I modify data in a sqlDataSource object (like inserting records, editing, deleting) similiary to how I modify data in a GradView using a DataList or repeater? I want to be able to have my own EditTemplate and be able to edit say four fields while I'm only viewing like two of them in the datalist/repeater.
<asp:DataList ID="DataList1" runat="server" DataKeyField="GameId"
DataSourceID="SqlDataSource1" RepeatColumns="1">
<ItemTemplate>
<%# Eval("field1") %><%# Eval("field2") %>....
</ItemTemplate>
<EditTemplate>......</EditTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT ...."></asp:Sql....>
When I'm trying to add a edit-button (<asp:Button runat="Server" ID="EditButton" Text="Edit" CommandName="Edit" />) and click it nothing happens....What is missing?
View 1 Replies
View Related
Jul 10, 2007
I have a DTS was created by another programmer which is for move online Database to a offline Database
and now I have to modify it
the DTS package
have 1 Source DB
and 63 distinateDB
between SourceDB and DistinateDB are "Black Line"
and almost of DistinateDB have a green line between a Task ( excute SQL work)
-- some of SQL work are Delete Table and some are Truncate Table
and now I have to add some limits for the DTS
1. First, move all the Data From online Database to Offline Database
2. to Delete Data from online DB , Online Database will only keep Data for 6 months ( older than 6 months have to delete except table A and table B)
can you help me? or tell me where have a reference information I can take a look... have no idea how to modify this DTS package..
thank you very much
View 3 Replies
View Related
Oct 30, 2007
my column UPdateTime , Type DateTime
UPdateTime
---------------------
2007-04-18 00:00:00.0002007-08-17 00:00:00.0002007-09-05 00:00:00.0002007-09-05 00:00:00.000
I write a Sql Query for select UPdateTime between 2007/09/01~ 2007/09/30
select * from ZT_Master where TDateTime < DateAdd(Month,-1,GetDate())
the result return all the column.. why?
thank you
View 5 Replies
View Related
Mar 12, 2008
I have the following query that produces this:
1 0 Arts & Entertainment6 1 Arts & EntertainmentDance2 1 Arts & EntertainmentMovies9 0 Automotive10 0 Business11 0 Cancer12 0 Communications3 0 Computers13 3 ComputersE-Learning4 3 ComputersHardware14 3 ComputersJava16 3 ComputersLink Popularity17 3 ComputersMicrosoft.net15 3 ComputersRSS5 3 ComputersSoftware7 0 Real Estate8 7 Real EstateFinance
Here is the query:
SELECT tblArticleCategory.ACategoryID, tblArticleCategory.AParentID, ISNULL(Parent.ParentCategory + '', '') + ISNULL(tblArticleCategory.ACategoryname, '') AS ACategory
FROM tblArticleCategory FULL OUTER JOIN(SELECT ACategoryName AS ParentCategory, ACategoryID
FROM tblArticleCategory AS tblArticleCategory_1
WHERE (AParentID =0) AND (AActive = 1)) AS Parent ON Parent.ACategoryID = tblArticleCategory.AParentID
WHERE (tblArticleCategory.AActive = 1)
ORDER BY ACategory
How do I modify this so that just the category name is returned and not the parent cetegory. In other words, everything shows up just once. Arts and Entertainment, once, then on the next line Dance, then Music then the next parent category which is automotive.
Here is the table:
ACategoryID int UncheckedACategoryName nvarchar(150) CheckedADescription nvarchar(300) CheckedAParentID int CheckedAActive bit Checked Unchecked
View 6 Replies
View Related
May 14, 2002
Hello ,
I have a problem with a publication which is a transactional replication on SQL Server 7.0 .
I want to add stored procedure to the existing publication along with the tables . But the Enterprise manager does not allow to select or check the box
against the required stored procedure although it displays when i right click on the publication and select proeprties .
Can i have some help in this regard ? Does anybody knows to add a stored procedure by means of a query .
Is there any other way to modify publication in SQL Server 7.0 although it is possible in SQL Server 2000 .?
Many thanks in advance.
Sandra .
View 1 Replies
View Related
Jul 20, 2002
Have a script that should extract data if :-
1) Mothly :-
-payday is equal to @today
-pay frequency is = 1
-payday between 1-31
2) Weekly
-payday is between 1-5 ( 1 =Monday,2 =Tuesday,3=Weds,4=Thurs,5=Friday)
-payfrequency is = 2
3) Fortnightly
-after two weeks
-payfrequency =3
How do l modify this procedure to be able to extract using the listed conditions ? Need help
CREATE Procedure Collections_Cats
AS
BEGIN
Declare @today int
Set @today = (SELECT Day(GETDATE()))
DECLARE Collections_Cats_Cursor
CURSOR
FOR
SELECT distinct
n.loan_No AS Loan_No,
n.customer_No AS Customer_No,
c.first_name AS First_name,
c.second_name AS Second_name,
c.surname AS Surname,
c.initials AS Initials,
b.Bank_name AS Bank_name,
br.branch_code AS Branch_code,
d.bank_acc_type AS Bank_acc_type,
pay_sheet.pay_frequency AS Pay_Frequency,
n.monthly_Payment AS monthly_Payment,
pay_sheet.payday AS payday
FROM Transaction_Record tr
INNER JOIN
Loan n ON tr.loan_No = n.loan_No
INNER JOIN
Customer c ON n.customer_No = c.customer_no
INNER JOIN
Bank_detail d ON c.customer_no = d.customer_no
INNER JOIN
Branch br ON d.Branch = br.Branch
INNER JOIN
Bank b ON br.Bank = b.Bank
INNER JOIN
pay_sheet ON c.customer_no = pay_sheet.customer_no
WHERE Pay_sheet.Payday = @today AND pay_sheet.pay_frequency =1
Order by l.loan_No
OPEN Collections_Cats_Cursor
-- Perform the first fetch.
FETCH NEXT FROM Collections_Cats_Cursor
-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch succeeds.
FETCH NEXT FROM Collections_Cats_Cursor
END
CLOSE Collections_Cats_Cursor
DEALLOCATE Collections_Cats_Cursor
END;
GO
View 1 Replies
View Related
Apr 20, 2004
Hi,
sql server 7
i have a replication job going on for one particular table from one server to another
now i have added two new columns in source and replication works fine.
once i add these two new columns in destination the replication is failing.
i went to properties of the publisher and select the filter columns where i can find all the columns checked except the two new columns when i try to select these two its not responding pls help me in this.
pls help me in modifying this replication.
TIA
hastal
View 2 Replies
View Related
Apr 16, 2008
Hi Guys,
I am using Sql server 2005, i am trying to find out all the tables that modified recently. i cant find any last modified date!!.
My situation is; i have altered so many tables, usually when i do alter i save the sql file for doing the same alteration in the production database. but somehow i lost the scripts and i am not sure what are the tables that i have modified and what is new.
i dont want to overwrite the whole database.
can anybody know how to get only the difference.
thanks
View 2 Replies
View Related
Jul 26, 2007
I have converted Access database to sql express. Access Database had AutoNumber FIelds for which trigger was generated by Upsizing wizard.
Now when I import data from client the autonumber field value changes because trigger is fired which distroys all links
I want to modify trigger so that it generates new number only when it is not supplied in a insert command.
Please help. Code is given below. Also suggest how to save because when I use save, it asks for a new .sql file name and a new file is generated instead of modifying the same trigger
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[T_AcControlLimit_ITrig] ON [dbo].[AcControlLimit] FOR INSERT AS
SET NOCOUNT ON
DECLARE @randc int, @newc int /* FOR AUTONUMBER-EMULATION CODE */
/* * RANDOM AUTONUMBER EMULATION CODE FOR FIELD 'IntAcControlCode' */
SELECT @randc = (SELECT convert(int, rand() * power(2, 30)))
SELECT @newc = (SELECT IntAcControlCode FROM inserted)
UPDATE AcControlLimit SET IntAcControlCode = @randc WHERE IntAcControlCode = @newc
View 1 Replies
View Related
Jul 20, 2005
Hi all,I have been left to modify an old unique index, which no longer works,as the two fields, which were used, are no longer unique. I’ve found twoothers that are unique. But as I’m new to this I need some advice first.What happens if one table inserts from another (the second containingthe index). However if there is a duplicate will the records which arenot duplicates be inserted? How could I insure this?ThanksSam*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 4 Replies
View Related
May 8, 2007
I initially modified the column 'ID' from not allowing NULL to allow, and saved it. But now I will like to change it back to 'not allow'. But it gives me the following error message when I try to save my changes:
'Pages' table
- Unable to modify table.
Cannot insert the value NULL into column 'ID', table <databasename>.Tmp_Pages'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Is there a way I can work around this?
Using sql 2005
View 1 Replies
View Related
May 8, 2007
Hi
I am trying to create a report with unknown number of report items. (as I dont know how many columns the stored proc is going to return).Is there a way to create these type of reports using SSRS other than creating the rdl programatically using vb.net or c#?
Let me know if I am not clear.
Thanks in advance.
View 1 Replies
View Related
Jan 14, 2008
HiI have developed a sql procedure for updating some xml content using SQL 2005 xQuery features.For example:Declare @xmlContent = '<books><book name="asp"/>< book name = "sql"/></books>'--Now I want to add attribute "book_id" to the xml content.SET @xmlContent.modify('insert attribute book_id{"1" } into (/books/book[@name="asp"])[1] ')SET @xmlContent.modify('insert attribute book_id{"2" } into (/books/book[@name="sql"])[1] ')SELECT @xmlContent--OUTPUT will be<books><book name="asp" book_id="1"/><book name="sql" book_id="2"/></books>QUESTIONQ1. Do we have any extension or plugin such that this SQl 2005 xquery feature can be incorporated in SQL 2000?Q2. If the answer for Q1. is no (as I expect), then do we have any TSQL feature in SQL 2000 for modifying xml content?I found all examples in SQl 2000 related with "openxml" function which performs the select kind of operations only. Like selecting data in XML format OR converting xml data in to tabular format. But I couldn't find any xml modification TSQL in SQl 2000 which can add element/attributes or change values.one workaround could be to consider xml content as string and use string functions to modify the content.But is there any more sensible approach available in SQL 2000?
View 1 Replies
View Related
Aug 2, 2004
Hi,
Below is the SP that I want to modify it such that it does another thing apart from what its doing now. I want to to delete all the records corresponding to the BpDate value before this insert happens. by meaning deleting all the records, I meant to say delete all records where BpDate = @BpDate and SiteCode = @SiteCode.
CREATE PROC CabsSchedule_Save
@JulianDate smallint,
@SiteCode smallint,
@BpDate smallint,
@CalendarDay smallint,
@BillPeriod smallint,
@WorkDay smallint,
@CalDayBillRcvd varchar(30),
@Remarks varchar(50)
AS
INSERT INTO
CabsSchedule(JulianDate, SiteCode, BpDate, CalendarDay, BillPeriod, WorkDay, CalDayBillRcvd, Remarks)
VALUES
(@JulianDate, @SiteCode, @BpDate, @CalendarDay, @BillPeriod, @WorkDay, @CalDayBillRcvd, @Remarks)
GO
Any help will be appreciated.
Thanks,
View 1 Replies
View Related
Aug 6, 2002
Within a trigger, is it possible to modify a row before it is inserted in SQL Server 7? I need to update two columns before the row is inserted by the trigger.
View 1 Replies
View Related
Oct 17, 2002
Please HELP!
I need to UPDATE a column by removing only the first occurance of $$sp;. I use the following to get an idea of what I have:
SELECT Reporting_Title_Html FROM Lab_Test Where RTRIM(Reporting_Title_Html)='$$sp;'
Reporting_Title_Html
------------------------------
$$sp;
$$sp;
$$sp;
$$sp;
$$sp;Thyroid maintenance required;$$sp..........
Get 5 Records....One record has multiple occurances of $$sp throughout the Reporting_Title_Html column.
I thought I could do:
Update Lab_Test Set Reporting_Title_Html=' ' Where RTRIM(Reporting_Title_Html)='$$sp;'
But I can't lose the trailing data from record #5. This is just a small sampling of what I'm trying to fix.
Any Ideas???
I've thought about REPLACE but that would replace all the $$sp's and I only want to change the very first one from $$sp to ' ' --> blank
View 1 Replies
View Related
Oct 27, 2003
I know how to modify the logical file name: ALTER DATABASE SATutorial
MODIFY FILE (NAME = Tutorial, NEWNAME = SATutorial_data)
GO
How would I modify the physical file name from (e.g.) Tutorial.mdf to SATutorial_data.mdf?
TIA...
Al
View 3 Replies
View Related
May 31, 2002
Hello
I have replicated 1 database.Now i need to change the datatype length of one feild from varchar 12 to varchar 20.But when i try to do that it shows error ODBC error !Cannot modify database because it is in replication mode.
Can any body help me to sort out this problem.
Thx
Bilal
View 1 Replies
View Related
Aug 20, 2004
Folks, i have rebuilt my old server machine and i've restored the MSDB over the new machine. Now when i try to edit or delete any of the jobs that come from the RESTORE; i get the following error message:
I never setup multiserver administration.
However i can create and delete new jobs.
How do i remove these older jobs.
Howdy!
View 5 Replies
View Related
Mar 10, 2006
Sigh, probably simple, but somehow I just can't get it to work..
I have a complex view which generated about 9000 results, and I use
a SP to select certain results from that view. How can I modify the
results of the SP? for example I want to add a zero to every single
companynumber the SP gives me...
*it's friday, i know*
Any help would be appreciated!
/Erwin
View 1 Replies
View Related
Jul 7, 2015
I face a task to edit definition for bunch of sp: cleaning <IF EXISTS THEN DROP> and changing CREATE for ALTER.
Do you think there is a good way to do it in batch and take original source from system.tables (even we have this as physical file in VSS)?
Surely enough <IF Exists then drop> is not uniformed, could be variations with syntax and on diff number of lines, IF Exists... vs OBJECT_ID is not null etc...
CREATE__sp_PROCEDUREA vs CREATE_spPROcedure (with diff spacing).
View 0 Replies
View Related
Jun 20, 2008
Hi,
Is it possible to increase the primary column size..?
The PK data type is Varchar (8). Now I want to increase to varchar (12).
Thanks
Lakshmi.S
View 4 Replies
View Related
Nov 22, 2007
Hi AllAm new to sql server to sobear with me, have checked around but cantfind an answer to this.I want to change fieldname from nvarchar(50) to nvarchar(255) as partof a scriptAm running this command :ALTER TABLE MYTABLE MODIFY fieldname nvarchar(255) nulli test this out in the sql window but cant get it to run error is:Msg 102, Level 15, State 1, Line 1Incorrect syntax near 'MODIFY'.Can anyone help ?
View 1 Replies
View Related
Mar 19, 2008
I have a 3rd party program that creates some tables in my sql server2005 database, then it does inserts on the tables. Is there a way Icould create a system level trigger that would immediately andautomatically modfiy the table structure after the table is created(hopefully before the inserts occur)? I need to change a field fromnumeric(5, 0) to numeric(15, 0).Thanks,Roger
View 3 Replies
View Related
Jan 19, 2006
hi!
i encountered problems when running this code in SQL Query
ALTER TABLE [dbo].[amsSchedule]
MODIFY(CutOff1 datetime NULL,
[FileName] varchar(100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL)
my aim is to modify the two fields to change its data type. BUt when im trying to run this command in the query analyzer, itsays "incorrect syntax error '(' "
What do i have to do? please help me...thanks
View 3 Replies
View Related
May 16, 2008
Hi,
I have few question:
1)Is it any methot to modify lock_timeout default value? (Default value is -1, if i want to modify default value for example 1, i try [SET lock_timeout 1;] but it only work during that session / connection)
2)Is it any method to modifyTransaction Isolation Level default value? (Default value is READ COMMITTED, if i want to modify default value for example READ UNCOMMITTED, I try [SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;], but it only work during that session / connection)
Thank you!~
View 2 Replies
View Related