Can I Use Single Function For A Big Project ???...
Jul 16, 2007
Hi,
I wnat to write a single function in code behind file for all DML operation, and i just want to pass query string in its parameter. but when ever my whole project will use this function to insert, update and delete. what will be the performance.
bool DMLoperation(string str)
{
obj.conn = new SqlConnection(obj.connstring);
obj.cmd = new SqlCommand(str,obj.conn);
obj.conn.Open();
try
{
if(obj.cmd.ExecuteNonQuery() > 0)
{
obj.conn.Close();
return true;
}
else
{
obj.conn.Close();
return false;
}
}
catch
{
obj.conn.Close();
return false;
}
}
I am totally confused about performance, is it good idea or worst ?.
View 2 Replies
ADVERTISEMENT
Apr 10, 2008
Can i share a function module to all the reports in a report project, that i can use the functions in the formating or expressions. Is there any way to add a assembly reference to the project and can include all the functions in an assembly file?
View 6 Replies
View Related
May 29, 2008
For some reason in a Team Foundation Team Project that has multiple project types (SSRS, SSIS, WebSite, C# Business DLL...), the SSIS project makes itself the startup project to the team project. If I explicitly set another project as the startup project to the team project and then select an SSIS package in the SSIS project in the team project, the SSIS project becomes the startup project automatically.
I am using Visual Studio 2005 SP1.
View 3 Replies
View Related
May 20, 2006
I can pass a parameter from an Access Query to an Access Report (MDB) by entering [Select Date] in the Query criteria and by placing an unbound control with a control source =[Select Date] on the report. I can't get this to work from a SQL Function Criteria to an unbound control on the Access Data Project Report. In the Function Criteria, I enter @SelectDate. In the Report control, I enter @SelectDate and it gives me an 'Invalide Column Name' error. Any idea how I can pass a parameter from a SQL Function to an ADP report?
THANKS!
p.s. I tried searching for other postings on this without any luck.
View 1 Replies
View Related
Mar 19, 2006
Hey everyone, I'm looking for a way to insert a count of a set of records into a table and then read that table and produce an XML file from that dataset. The problem that I'm coming across is that when you do this type of query you have to specify one of the values from the table and then get a count for the number of records of that particular range of values.
The table that I am trying to get the data from will look something like this:
ItemID ModuleID Description ......1 2869 blah blah blah2 2869 blah blah blah3 2869 blah blah blah4 2690 bit bit bit5 2690 bit bit bit6 2690 bit bit bit
So I count the 2869's and 2690's and place the ModuleID and the count of the ItemID's in another table.
Then I need to extract the data from the table and put it into an XML file that is readable by the ReadXML method in ASP.NET.
So far I've got the SPROC to do only one record at a time but I would like one that does the whole table rather than one at a time using a parameter.
View 5 Replies
View Related
Mar 10, 2008
I wrote a Scalar UDF in SQL2005 that returns an integer. I want to be able to display this integer in a ASP.Net 2.0 web page. I typically use a DAL for all data so I added an ObjectDataSource as a Qeury that contains only the UDF. How do I easily display the value in a Label Control or?
I have tried to use a Repeater with a label, a Formview with a Label, all to no avail. Any suggestions?
View 12 Replies
View Related
Aug 9, 2007
Hi all,
I have a scenario which I am not able to figure out how to do it better for quite some time.
Assume I have a few rows of data :
RunningID Date WOid
1234 1/23/2007 23
1236 1/24/2007 23
1239 1/2/2007 24
1222 1/4/2007 23
1321 2/4/2007 22
My objective is to merge all RunningID into a single cell when WOid is the same (this will most probably use a "group by" to get the different WOid out). Maybe some aggregate function that can do it as:
select ReturnConca(RunningID, "#") as RunningID_str, max(Date) as MaxDate, max(WOid) as WO from tableXXX
group by WOid
Results:
RunningID_str MaxDate WO
1234#1236#1222 1/24/2007 23
1239 1/2/2007 24
1321 2/4/2007 22
Any advise would be much appreciated.
View 6 Replies
View Related
Jul 17, 2015
I would like solving the following issue using the Patindex function i cannot retrieve or extract the single numeric value as an example in the the values below i would like retrieve the Value 2, but in my result set the value 22 also appears or it is completely omitted.
"2 8 7"
"2 8"
"2"
"22"
"3 2 8"
I have tried the following
Patindex('%[2]% [^0-9] [^1] [^3] [^4] [^5] [^6] [^7] [^8] [^9]' ,Replace(Replace(Marketing_Special_Attributes, '"',''),'^',' ')) as Col3,
Patindex('[2]' ,Replace(Replace(Marketing_Special_Attributes, '"',''),'^',' ')) as Col4,
Patindex('%[2][^0-9]%',Replace(Marketing_Special_Attributes,'^',' ')),
View 5 Replies
View Related
Apr 21, 2015
We run std 2008 r2. I haven't looked at my friend's function closely yet bur he showed me that when he selects from the function with one column and the same where clause he uses on same func with select *, he gets no data under the column he requested.Â
But when he selects * he gets a single row.
I took a peek and see a bunch of left joins followed by a bunch of outer applies in his func. I suppose (thinking out load) if anything random like the order of rows returned or sql decisions on how query runs can affect his function, that might explain it. Â
View 8 Replies
View Related
Jun 24, 2007
Hi,
I have been working on some SSIS packages for a while now and today while i was working i was trying to create a new connection and in the process there was an error and it said the BIDS has to be closed and i closed it but later when i open BIDS and try to open my project(.sln) from the file menu to work on the half done package it pops up an error which shows the path to my project location on the first line and next statement on the pop up error box says:
"Make Sure the application for the project type (.dtproj) is installed."
I tried to check some forums in which some suggested to try installing SP1 which i tried but ..i dont know why but the SP1 fails to install (i dont know if its causing problem becoz i already installed SP2 as i had some other problem before for which the cure was to install SP2).
Did anyone here face such a problem before ?
I'd really appreciate if the experts here can tell a cure for this problem.
thanks,
Ravi
View 4 Replies
View Related
Feb 23, 2007
I have a Visual Studio 2005 solution which contains a Sql Server Integration Services (SSIS) project.
In this solution I have explicitly set a Web application project as startup project, but whenever I edit a DTS package within the SSIS project, VS automatically sets the SSIS project as startup project and the package I edit as startup object.
Needless to say, this may cause some really unwanted incidents when running the solution - thinking that you're about to run the Web application project (that was explicitly set as startup project), but instead, you run the edited package in the SSIS project.
Is there any way to avoid having the SSIS project automatically setting itself as startup project, any workaround here at all? :)
Thanks.
View 4 Replies
View Related
Jun 16, 2015
in order to maintain a deployed project into an Integration Services Catalog I'd like to know if it is possible to import it into a new project inside SSDT.
View 5 Replies
View Related
May 6, 2007
Hi,
I want to update value of a custom field for a perticular project in Project Server 2007 using PSI.
I have created 5 enterprise custom fields(A,B,C,D,E) through PWA/Server Settings.
I want to search all Projects on Server. If any project is having value for custom field A then I want to update rest of the custom fields(B,C,D,E) for that perticular project.
I dont know how to do it please help.
Thanks in Advance
Madhukar
View 5 Replies
View Related
Feb 3, 2007
I have a very small project written in VB.Net 2005 using the SQL Server 2005 SSiS DTSx package.
I took a SQL Server 2000 dts package and using the SQL Server 3005 legacy tools migrated it so I could still use the package withing SQL 2005 until I can build one using BI/SSIS.
Anyway,I added the reference Microsoft.SqlServer.ManagedDTS so I could then use the Microsoft.SqlServer.Dts.Runtime so I can execute the commands:
Dim oApp As New Application
Dim oPkg As New Package
oPkg = oApp.LoadPackage(g_DTSx_Directory & "AOC copy Generic1 CSV to AOC_verify_file_1.dtsx", Nothing)
Dim oResults As DTSExecResult
oResults = oPkg.Execute
Ok. That works fine. Executes without a hitch. So now I try and create a setup project for this and I use the setup wizard.
During the creation of the setup project I get a message that states:
The following files may have dependencies that cannot be determined automatically. Please confirm that all dependencies have been added to the project.
C:windowssystem32msxml6.dll
OK. The dll is part of the reference I mentioned above and I have no idea what other dependencies it may have.
How do I find this out?
Has anyone else created a project like this and experenced the same?
I am on a clean build running WinXP Pro with SP2 - VS2005 with SP1 and the SQL Server 2005 tools.
View 1 Replies
View Related
Apr 20, 2015
I've got an SSIS solution file with project deployment model in VS 2013 and would like to deploy that to SSISDB on different environments.All these days I followed the regular way to create a project in SSISDB and deploy it to that. Now want to find out if i can automate this process and so got some questionsÂ
1. Can we automate the process of creating a project on SSISDB based on our SSIS project name? This will be like when we do a deployment it should check if the project exists or not on SSISDB based on our SSIS project name, if the project exists we just deploy the packages in the project and if the project does not exists in SSISDB it will create that project and deploy the packages.
2. Can we also automate the process of creating environments? In traditional way we manually create the environment variables under environment tab of SSISDB, but can we make that also as part of deployment? Like when we are releasing to Dev server we look if that particular Dev variable exists on that server, if it exists we just update the existing stuff and if it does not exists we just create it.
View 2 Replies
View Related
Mar 31, 2008
I have visual studio 2005 and sql server 2005 with integration service installed on my machine. Couple of days ago, I installed visual studio 2008 professional. When I go to create SSIS project I dont see it in visual studio 2008. What do I have to do to make it appear in visual studio 2008 so that I can create SSIS projects.
Thanks.
View 7 Replies
View Related
Jul 23, 2007
I fail to use project professional 2003 to access to the project server 2003 using MSDE 2000 in local area network, following message was shown,
Connection failed:
SQLState: '01000' SQL Server Error 1326 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect())
Connection failed:
SQLState '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
I have seen these pages with similiar cases but can't help.
http://support.microsoft.com/kb/818047/
http://support.microsoft.com/kb/837653/en-us
Can anyone help me?? Thanks a lot!
View 1 Replies
View Related
Mar 13, 2008
Hi all How can create trigger in sql server project in VB.NET 2.0 ?thanks in advance
View 1 Replies
View Related
Jan 12, 2007
Howdy again...
Do I need to re-create a new package from scratch after doing what I did?
It seems I've made what is probably a typical newbie mistake: I used COPY/PASTE
to
consolidate containers from two packages into a single new project/package.
Now my new package generates multiple duplicate errors (23 of each...) whenever I open it:
Warning loading LoadBillingData.dtsx: Process configuration failed to set the
destination at the package path of "PackageData Flow Task to Load
Profiles, Versions, and
Transactions.EventHandlers[OnError].Variables[System::Propagate].Properties[Namespace]".
This occurs when attempting to set the destination property or variable fails.
Check the destination property or variable.
Error loading LoadBillingData.dtsx: Changing the name of a variable failed
because it is a system variable. System variables are read-only.
What happened:
new guy (goes without saying...) creates:
01. PROJECT A
02. add PACKAGE
A to PROJECT A
03. add some
containers, figger out what the heck is going on, get containers working
04. create
PROJECT B
05. create
PACKAGE B
06. add
containers, they work fine
07. whoops!
Want to consolidate the packages. Unix guy naively expects Bill has made MS
Visual Studio like all windows products (of which newbie is aware€¦):
08. create
PROJECT C
09. create
PACKAGE C
10. <ctrl
a> PACKAGE A
11. <crtl
c> PACKAGE A
12. <ctrl
v> PACKAGE C
13. <ctrl
a> PACKAGE B
14. <crtl
c> PACKAGE B
15. <ctrl
v> PACKAGE C
16. copy Flat
File Connection Managers
17. copy
Database Connection Manager
18. drag the
arrows around, fix the flat file sources, renew the column maps, etc
19. whoops! the
connections all look like a registry number! Fix the OLE DB Destinations,
Execute SQL Task containers by selecting the DB Connection Manager copied from
PROJECT A
20. successfully
execute PROJECT C/PACKAGE C
21. save all
22. exit
23. start MS
Visual Studio
24. Open
Solution
25. ERRORS!!!
Is this fixable?
Thanks,
Bill
View 1 Replies
View Related
Jan 17, 2008
Hello,
I've created a Report Model Project that can be used by Report Builder to generate ad-hoc reports. I'm trying to create a connection string in my Report Server Project that points to the Report Model Project data source view.
All I can do is create a regular datasource, which bypasses the metadata contained in the Data Source View.
Basically I want my Report Server Project and my Report Builder reports to leverage the same metadata. Is this possible? If so how do I get the connection string?
Thanks!!
-Matt
View 1 Replies
View Related
Jul 1, 2006
Hi All,I've been struggling with this for hours...Could someone please advise me on how to convert my current File based SQL Server Express website to a Server based SQL Express one.Particularly interested in what I need to do in the SQL Express management tool, changes I need to make the projecvt itself and changes needed to get IIS to understand things have been changed.Thanks,Martin.
View 1 Replies
View Related
Feb 12, 2015
I have a code like this:
SELECT Node_ID,Day,Operation, AA,BB
FROM
(SELECT
CASE
WHEN Operation LIKE 'NOTIFY' THEN SUM(Total_request) ELSE 0 END AS AA,
CASE WHEN OPERATION LIKE 'SEARCH' THEN SUM(Total_requests) ELSE 0 END AS BB,Node_ID,DAY,Operation
[code]....
So i want to make two columns by the name of operation. in the real code AA and BB are calculates with many counters. My code doesn't work, I have an error: "not a single-group group function" .....
View 1 Replies
View Related
Apr 4, 2006
How can i combine my data in single row ? All data are in a single table sorted as employeeno, date
Code:
Employee No Date SALARY
1 10/30/2006 500
1 11/30/2006 1000
2 10/25/2006 800
3 10/26/2006 900
4 10/28/2006 1000
4 11/01/2006 8000
Should Appear
Code:
EmployeeNo Date1 OLDSALARY Date2 NEWSALARY
1 10/30/2006 500 11/30/2006 1000
2 10/25/2006 800
3 10/26/2006 900
4 10/28/2006 1000 11/01/2006 800
PLEASE HELP I REALLY NEED THE RIGHT QUERY FOR THIS OUTPUT.
THANKS IN ADVANCE
View 3 Replies
View Related
Aug 1, 2005
I have this function in access I need to be able to use in ms sql. Having problems trying to get it to work. The function gets rid of the leading zeros if the field being past dosn't have any non number characters.For example:TrimZero("000000001023") > "1023"TrimZero("E1025") > "E1025"TrimZero("000000021021") > "21021"TrimZero("R5545") > "R5545"Here is the function that works in access:Public Function TrimZero(strField As Variant) As String Dim strReturn As String If IsNull(strField) = True Then strReturn = "" Else strReturn = strField Do While Left(strReturn, 1) = "0" strReturn = Mid(strReturn, 2) Loop End If TrimZero = strReturnEnd Function
View 3 Replies
View Related
Dec 9, 2007
Hi all,
I executed the following sql script successfuuly:
shcInLineTableFN.sql:
USE pubs
GO
CREATE FUNCTION dbo.AuthorsForState(@cState char(2))
RETURNS TABLE
AS
RETURN (SELECT * FROM Authors WHERE state = @cState)
GO
And the "dbo.AuthorsForState" is in the Table-valued Functions, Programmabilty, pubs Database.
I tried to get the result out of the "dbo.AuthorsForState" by executing the following sql script:
shcInlineTableFNresult.sql:
USE pubs
GO
SELECT * FROM shcInLineTableFN
GO
I got the following error message:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'shcInLineTableFN'.
Please help and advise me how to fix the syntax
"SELECT * FROM shcInLineTableFN"
and get the right table shown in the output.
Thanks in advance,
Scott Chang
View 8 Replies
View Related
Oct 19, 2004
I need to know how can i incoporate the functionality of DECODE function like the one in ORACLE in mSSQL..
please if anyone can help me out...
ali
View 1 Replies
View Related
Mar 22, 2006
Got some errors on this one...
Is Rand function cannot be used in the User Defined function?
Thanks.
View 1 Replies
View Related
Jan 7, 2014
I need to be able to pass the output of a function to another function as input, where all functions involved are user-defined in-line table-valued functions. I already posted this on Stack Exchange, so here is a link to the relevant code: [URL] ...
I am fairly certain OUTER APPLY is the core answer here; there's *clearly* some way in which does *not* do what I need, or I would not get the null output you see in the link, but it seems clear that there should be a way to fool it into working.
View 5 Replies
View Related
Jul 24, 2007
Hi,
I wonder if there a function that i can use in the expression builder that return a value (e.g o) if the input value is null ( Like ifnull(colum1,0) )
i hope to have the answer because i need it so much.
Maylo
View 7 Replies
View Related
Feb 4, 2008
Can anybody know ,how can we add builtin functions(ROW_NUMBER()) of Sql Server 2005 into database library.
I get this error when i used into storeprocedure :
ROW_NUMBER() function is not recognized in store procedure.
i used MS SQL SERVER 2005 , so i think "ROW_FUNCTION()" is not in MS SQL SERVER 2005 database library.
I need to add that function into MS SQL SERVER 2005 database library.
Can anbody know how we can add that function into MS SQL SERVER 2005 database library?
View 4 Replies
View Related
Jul 20, 2005
I want to write function to call another function which name isparameter to first function. Other parameters should be passed tocalled function.If I call it function('f1',10) it should call f1(10). If I call itfunction('f2',5) it should call f2(5).So far i tried something likeCREATE FUNCTION [dbo].[func] (@f varchar(50),@m money)RETURNS varchar(50) ASBEGINreturn(select 'dbo.'+@f+'('+convert(varchar(50),@m)+')')ENDWhen I call it select dbo.formuła('f_test',1000) it returns'select f_test(1000)', but not value of f_test(1000).What's wrong?Mariusz
View 3 Replies
View Related
Apr 16, 2008
A Southwest Booksellers has stores in three cities:
Albuquerque {Winrock, OldTown, NobHill}
Santa Fe {VistaView, MesaVerde}
Taos {Zia, Zuni}
and sells nine categories of books:
{Computers,Science,ArtHealth,SelfHelp,Business,Fiction,History,Religion}.
The bookstores will keep a database of transaction records for one year.
A sales transaction record contains fields for city id, store id,
book category id, date, and quantity of category sold.
They would like to have a database of aggregate historical data from which
to generate the following reports:
1) Show city sales by quarter for a given year.
2) Show store sales by quarter for a given year.
3) Show Book Category sales by quarter for a given year.
4) Show city sales by year.
5) Show store sales by year.
6) Show Book Category sales by year.
7) Show sales by Book Category and quarter for a given store and year.
Your solution should simulate annual processing and
contain the following elements:
1) Script to generate transaction records.
2) Star Schema database of aggregate historical data.
3) ETL algorithm.
4) Reports implemented as Stored Procedures.
Demonstrate your solution using the following data:
Year Transactions
---- ------------ --------------------------------
2000 1000
2001 1500 TheCaverns store in Carlsbad
2002 2100
2003 2800 Philosophy category
2004 3600 CasaDelRio store in SantaFe
2005 4500 Travel category
A transaction is one book category of quantity between 1 and 5.
please see what i did
create table city
(
idc tinyint,
city varchar(20)
);
insert into city values(1,'Albuquerque');
insert into city values(2,'Santa Fe');
insert into city values(3,'Taos');
create table Alb
(
idal tinyint,
store varchar(20)
);
insert into Alb values(1,'Winrock');
insert into Alb values(2,'Oldtown');
insert into Alb values(3,'NobHill');
create table Santa
(
idsan tinyint,
store varchar(20)
);
insert into Santa values(1,'VistaView');
insert into Santa values(2,'MesaVerde');
create table Taos
(
idta tinyint,
store varchar(20)
);
insert into taos values(1,'Zia');
insert into taos values(2,'Zuni');
create table books
(
bid tinyint,
type varchar(10)
);
insert into books values(1,'Computers');
insert into books values(2,'Science');
insert into books values(3,'Arthealth');
insert into books values(4,'Selfhelp');
insert into books values(5,'Business');
insert into books values(6,'Fiction');
insert into books values(7,'History');
insert into books values(8,'Religion');
create table y2000
(
qtr tinyint,
);
insert into y2000 values(1);
insert into y2000 values(2);
insert into y2000 values(3);
insert into y2000 values(4);
create table SalesCube
(
idal tinyint,
idsan tinyint,
idta tinyint,
bid tinyint,
qtr tinyint,
qty smallint
);
create table ST
(
idal tinyint,
idsan tinyint,
idta tinyint,
bid tinyint,
qtr tinyint,
qty tinyint
)
-- Populate Transaction Table
declare @n smallint,
@idal tinyint,
@idsan tinyint,
@idta tinyint,
@bid tinyint,
@qtr tinyint,
@qty tinyint
set @n = 1
while @n <= 1000
BEGIN
set @idal = convert(tinyint, rand()*100) % 5 + 1
set @idta = convert(tinyint, rand()*100) % 5 + 1
set @idsan = convert(tinyint, rand()*100) % 5 + 1
set @bid = convert(tinyint, rand()*100) % 5 + 1
set @qty = convert(tinyint, rand()*100) % 5 + 1
set @qtr = convert(tinyint, rand()*100) % 5 + 1
insert ST values( @idal ,
@idsan ,
@idta ,
@bid ,
@qtr ,
@qty )
set @n = @n + 1
END
insert salescube (idal,idsan,idta,qtr,qty)
select idal ,
idsan,
idta,qtr,sum(qty)from st
group by idal,idsan,idta,qtr
with cube
this is not working properly. i really do not know how to aproach quarters in the year.
possibly my tables are wrong too.
how to populate transaction tables?
if anyone has any advices i will be happy to apply it.
thanks
View 2 Replies
View Related
Nov 11, 2006
I need a simple SQL project,like pay rolls of a company,etc so that i acn improve in SQL,i feel its d best way to learn a language
View 9 Replies
View Related