Formatted Procs
Mar 3, 2004
Can somebody provide me an argument on how nicely formatted and indented procs perform better. I am currently formatting a 1000 line proc just to understand what it does ... Maybe your argument will help convince my development team to write neat procs :)
View 8 Replies
ADVERTISEMENT
Jan 15, 2008
Is there a way to namespace groups of stored procs to reduce confusion when using them?
For C# you can have ProjectName.ProjectSection.Classname when naming a class. I am just wondering if there is a way to do the same with SQL stored procs. I know Oracle has packages and the name of the package provides a namespace for all of the stored procs inside it.
View 1 Replies
View Related
Mar 29, 2001
Is there a way to store a formatted text (bold, italicized etc) in a text field on SQL Server 7.0 ?
View 2 Replies
View Related
Jul 20, 2005
Hi,Is there a way to get stored procedure texts out in a formatted waylike defncopy in Sybase????? The way they print it out reallysucks............RegardsSubhas
View 1 Replies
View Related
Jan 22, 2007
I have a table for articles that I want as
the basis for a blog. I have a field of description where the actual
article will go, I have only ever really
used tables to put in 'blocks' of text, how would I go about storing/displaying
data that is in my database table in a more formatted way, for example line
breaks, indents etc?
View 4 Replies
View Related
Mar 29, 2007
Hi,
I am trying to write the output of an sql query to a text file using bcp. Now the problem am facing is i have to format the text like i the following order...
<DATETIMESTAMP>08:39 Thursday, March 15, 2007</DATETIMESTAMP><CATEGORY>Quarterly Sales</CATEGORY><HEADLINE>Quarterly Corporate Earnings (03/15/07)</HEADLINE><BODY> Quarterly Corporate Profits (03/15/07) PER-SHARE ($) NET EARNINGS (mil$) REV. (mil$)COMPANY CURRENT YEAR-AGO CURRENT YEAR-AGO CURRENT YEAR-AGOabc 0.33 n/a 8.60 (13.30) 144.40 112.50 bcdf 0.16 (0.15) 7.80 (7.40) 101.90 81.20 gha n/a n/a (90.00) (80.00) 488.00 462.00 qwqw (0.10) (0.15) (3.30) (4.30) 2.90 2.20
Copyright(c) 2007 mycompany.com, Inc. All Rights Reserved</BODY>
Would somebody please advice whther this sort of formatting is possible with bcp..Please give some pointers am completely stuck....the company data is coming from a database table...am using sql 2005...
Thanks in advance
View 1 Replies
View Related
Feb 25, 2005
I get this message in the SQL Server logs after I restore a db. I copied this backup from another server is that why it's telling me it formatted incorrectly? The strange thing is in QA it restores successfully but when I look @ EM it's remains in Loading mode and never completes
The backup data in 'D:SQLServerMSSQLackupjan_prod_db_20050214173 0.BAK' is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable.
View 3 Replies
View Related
Feb 17, 2005
Hi All,
I am kindly seeking for help.
I have a table(MyTable) which is defined as (date datetime, ID char (10), and R, P,M,D&Y are all float) and the layout is as following:
Date ID R P M D... Y
1/1/90 A 1 2 3 4... 5
1/2/90 A 2 3 4 5... 1
...
2/11/05 A 3 4 5 6... 2
1/1/90 B 1 2 3 4... 5
1/2/90 B 2 3 4 5... 1
...
2/11/05 B 3 4 5 6... 2
...
The expected query results look like: ( this results from Date, ID and R fields)
Date A B
1/1/90 1 1
1/2/90 2 2
...
2/11/05 3 3
The SQL I wrote:
select date, ID,
A=sum(case when ID=A then R else 0 end),
B=sum(case when id=B then R else 0 end)
from MyTable
Group by date
I would also like to get another set of results with the same format but from date,ID and P fields:
Date A B
1/1/90 2 2
1/2/90 3 3
...
2/11/05 4 4
select date, ID,
A=sum(case when ID=A then P else 0 end),
B=sum(case when id=B then P else 0 end)
from MyTable
Group by date
The problem with that is if I have thousands of ID in MyTable I have to "hard code" thousands times and the same problem with the fields/columns. Is there any easier way to do this?
I also would like to insert the results into a table/view which will be refreshed whenever MyTable gets updated.
Any suggestion/comments are highly appreciated!
shiparsons
View 4 Replies
View Related
Jan 9, 2006
Hi All ,
Is it possible to insert the below text into a column and retrieve it in the same format ?
Thanks,
Hari Haran Arulmozhi
TEXT :
CLIENT NAME : ABC Corporation
CLIENT CITY : MUMBAI
================================================
INV_NO INV_DATE INV_AMT
================================================
I100 01-01-2006 Rs.600
I200 01-02-2006 Rs.800
I300 01-03-2006 Rs.1600
I400 01-04-2006 Rs.2600
I500 01-05-2006 Rs.9600
RECEIVED ADVANCE :Rs.10000
View 3 Replies
View Related
Dec 28, 2011
I have 265 word documents which I use with mail merge to create a master document.We are going to auto generate this master document going forward so I want to store these 265 word documents, these range in size from 10kb to 50kb. As I mentioned these are formatted and also contain a merge field/marker so what I will be doing is using a value in the database, my application will take the document which is stored as a string/blob and will replace the "merge field" with the value from the database.
I can write an application to import each of these documents but I am not sure whats the best way to store them in order to be able to find and replace the merge marker.Also I will be joining a number of these together to make the master document. So for example I take 10 of these and I replace the marker fields in these with the values from the database, I will then push that string out to a PDF/Word document for printing.
View 1 Replies
View Related
Nov 9, 2007
I need to export data to a worksheet and format the resultant sheet appropriately. I kow server side automation is a no-no. What would be the best alternative to accomplish this?
View 16 Replies
View Related
Jan 12, 2006
Hi, that's the problem:
I have a GridView, bound to a SQLDataSource, with an stored procedure as a Select query. The Select Parameters are bound to controls in the web form, acting like some filter fields.
When I submit the page, everythings works fine, except when I try to set some value in the DateTime fields. .Net is enclosing the date with extra single quotes, as I could see in the Profiler:
exec sel_despesa_procura @codigo=NULL,@fornecedor=NULL,@descricao=NULL,@vencto_ini=''2005-10-10 00:00:00:000'',@vencto_fim=''2005-10-20 00:00:00:000'',@pagto_ini=NULL,@pagto_fim=NULL,@valor=NULL,@valor_pago=NULL,@centro_custo=NULL,@pago=N'0,1'
The fields are defined as follows:
<SelectParameters>...<asp:ControlParameter ControlID="txtFiltroVencIni" Name="vencto_ini" PropertyName="Text" Type="DateTime" /><asp:ControlParameter ControlID="txtFiltroVencFim" Name="vencto_fim" PropertyName="Text" Type="DateTime" />...</SelectParameters>
The stored procedure doesn't even execute, due to the bad formatted arguments. It returns the error:
Msg 102, Level 15, State 1, Line 1Incorrect syntax near '2005'.
I'm going to change the parameter type to varchar, as a workaround, but I'd like to solve this problem.
Thanks in advance,
Anderson
View 1 Replies
View Related
Jul 3, 2001
Using the stored proc XP_Sendmail i am able to send mails successfully. But i need to format the mail.. so for formatting i am using HTML tags.. so when i am sending the mail the html tags are getting displayed as it is. So pls can any body tell me how i can send the HTML formatted mail.
View 2 Replies
View Related
Aug 3, 2002
What does this error message mean ? We have SQL2000, with database FULL RECOVERY. Other databases on the server are fine. Backups stopped working a week ago. Can't remeber anything changing
+++++++++++++++++++++++++++
The backup data in 'D:BackupTI backup.BAK' is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable. [SQLSTATE 42000] (Error 3266) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
View 1 Replies
View Related
May 9, 2006
I have some textual data that comes preformatted with some extra spaces and line feeds. I am attempting to put it in a Report using SSRS 2005.
When ever I view the report in HTML Mode all of the extra whitespace is suppressed into a single space. However when I export to PDF or Word it all comes back. I have tried using the .Replace() method to put in and <BR> tags into my code, but then it just displays the extra text and doesn't display it as HTML.
Is there anyway either replace the items with the appropriate HTML, or add the "PRE" whitespace CSS attribute to a Textbox so that the text displays the same in HTML and in a PDF?
Thanks.
View 2 Replies
View Related
Jun 8, 2006
I am developing a resume storage system, and don't know the best way to store the resumes that come in to our company in both MS Word and text files. Should I store the files in the original format they come in, and reference the file name in the databse that points to a directory where they are stored, or should I store the text of the resumes directy in the database. There are 2 things that I must follow.
1: I need to have the documents keep their formatting.
2: I also need the capibility of conducting a full text search to pull out key words from the documents.
What is the best way?
View 1 Replies
View Related
Jun 12, 2006
I'm running a query with osql, and I'm trying to get some clean output that is comma delimited. So far my line looks like this:osql -E -n -d mydb -i custom.qry -o "c:output
esults.csv" -h-1 -s ","This works off a table with only two columns. I'm still left with a lot of extra spaces between the first column output and second column output, and at the bottom the text "(50 rows affected)".So instead of this:data1a (lots of spaces here) ,data1bdata2a (lots of spaces here) ,data2bdata3a (lots of spaces here) ,data3b(50 rows affected)I want to see this:data1a,data1bdata2a,data2bdata3a,data3bThanks very much for any help. :)
View 2 Replies
View Related
Feb 22, 2007
Hello,I thought this would be easy, and I've read a lot of posts, but Ican't seem to find exactly what I'm trying to do.
Quote:
View 3 Replies
View Related
Jan 30, 2007
Hello,
I am running reporting server on a "english" server with dutch regional settings.
My client and the client of the users are also a "english" client with dutch regional settings.
A dutch number should be formatted like 1.234.567,89
Unfortenately when I run a report I get the number back (non formated) like 1234567.89
How do I get it in the dutch format ?
With regards,
Constantijn Enders
View 2 Replies
View Related
Mar 8, 2004
What is the recommended method of returning a formatted date from a stored procedure?
The date is held in a date time field. I wish to return the date formatted as:
dd/mm/yyyy hh:mm
for display in a bound text box on a win form. JUst selecting the date and binding it to the text box shows:
dd/mm/yyyy hh:mm:ss
I do not want the :ss to show. A textbox does not have a format property (that I can see). I suppose I could create my own textbox inheriting from the standard and apply a display format property. I thought it may be easier to select as required in an sp. The textbox is read only on the form.
I was looking at:
select jobHeaders.DateTimeJobTaken AS [Job Taken],
CAST(datepart(dd,jobHeaders.DateTimeJobTaken) as char(2)) + '/' +
CAST(datepart(mm,jobHeaders.DateTimeJobTaken) as char(2)) + '/' +
CAST(datepart(yyyy,jobHeaders.DateTimeJobTaken) as char(4))
from jobHeaders
but this gives :
8 /3 /2004 with spaces.
Before looking further I thought one of you guys may have the answer.
Thanks in advance
View 14 Replies
View Related
May 26, 2008
Hey there,
I have a field called renew_date which is of (int) type, and represents a date in the format 'yyyymmdd'.
Eg. If the renew date were yesterday the field would contain: 20080525.
I need a select statment that will determine if the date contained in this field is '<' todays date.
I have wrote a select statement that works, however I'm wondering if there is a better way to handle this.
select * from sometable
where renew_date <
convert(int, convert(varchar, DATEPART(yyyy, getDate())) +
convert(varchar, Right('0' + Convert(VarChar(2), DATEPART(mm, getDate())),2)) +
convert(varchar, Right('0' + Convert(varchar(2), DATEPART(dd, getDate())),2)))
Any help you may provide is greatly appreciated.
Thanks
--Mike
View 2 Replies
View Related
Aug 2, 2006
I need to create a query (SQL 2000) that renders a formatted excel (xml or xls) file for each row that is outputted.
The details, I have a Campaign table that contains information for Auto and Life "Leads" and the data is submitted by telemarketers directly into the database. I need to render a file for each line, and it would be good if It were an Excel XML or XLS file, because that's what we've been using for a while.
View 4 Replies
View Related
Apr 24, 2007
The latest similar question is almost a year old and hasn't been definitively answered. I'm designing a certificate type report where the declaration text uses static and dynamic text generated in an expression for the textbox. The problem is that there doesn't seem to be an obvious way of formating sections of the text expression with different font sizes, weights and attributes to depict the effect desired. E.g. I want one textbox to say:
This Certifies that {a field value} was blah blah blah by {another field value} etc.
Can this be done in a regular textbox? If not, are there any work-arounds to accomplish the same effect. BTW, I'm working in RS 2005 flavor with VS 2005 Report Designer.
Thanks in advance for your help.
View 4 Replies
View Related
Oct 19, 2015
I have the following a computing column
(isnull(TotalProductSaleCost,0) * 7) / 100
I would like the output to be formatted to decimal (12, 2) not sure how to achieve this?
View 4 Replies
View Related
Jul 2, 2007
I am considering whether SSIS can be used to deal with a formatted report that consists of a number of pages delimited by a control character with rows deleimited by CRLF. There are a number of header records that will need to be removed on each page and each line consists of data in fixed width columns.
The files will be fed to us on a regular basis so we will require an automated solution
Can I use one of the import objects available within SSIS directly to deal with this kind of file or will I have to bite the bullet and start coding a solution using C# or vb.net ?
View 4 Replies
View Related
May 7, 2004
HI,
CREATE PROCEDURE PROC1
AS
BEGIN
SELECT A.INTCUSTOMERID,A.CHREMAIL,B.INTPREFERENCEID,C.CHR PREFERENCEDESC
FROM CUSTOMER A
INNER JOIN CUSTOMERPREFERENCE B
ON A.INTCUSTOMERID = B.INTCUSTOMERID
INNER JOIN TMPREFERENCE C
ON B.INTPREFERENCEID = C.INTPREFERENCEID
WHERE B.INTPREFERENCEID IN (6,7,2,3,12,10)
ORDER BY B.INTCUSTOMERID
END
IF I AM USING THIS PROC AS I/P TO ANOTHER PROC THEN IT GIVES NO PROBLEM AS I CAN USE ?
CREATE PROCEDURE PROC2
AS
BEGIN
CREATE TABLE #SAATHI(INTCUSTOMERID INT,CHREMAIL NVARCHAR(60),INTPREFERENCEID INT,CHRPREFERENCEDESC NVARCHAR(50))
INSERT INTO #SAATHI
EXEC PROC1
ST......1,
ST......2,
END.
BUT IF , I USE ANOTHER PROC SIMILAR TO THE FIRST ONE WHICH GIVES SLIGHTLY DIFFERENT RESULTS AND GIVES TWO SETS OF RESULTS,THEN WE HAVE A PROBLEM,HO TO SOLVE THIS :-
CREATE PROCEDURE MY_PROC
AS
BEGIN
SELECT A.INTCUSTOMERID,A.CHREMAIL,B.INTPREFERENCEID,C.CHR PREFERENCEDESC
FROM CUSTOMER A
INNER JOIN CUSTOMERPREFERENCE B
ON A.INTCUSTOMERID = B.INTCUSTOMERID
INNER JOIN TMPREFERENCE C
ON B.INTPREFERENCEID = C.INTPREFERENCEID
WHERE B.INTPREFERENCEID IN (23,12,10)
ORDER BY B.INTCUSTOMERID
END
SELECT A.INTCUSTOMERID,MAX(case when A.intpreferenceid = 23 then '1'
else '0' end) +
MAX(case when A.intpreferenceid = 12 then '1'
else '0' end) +
MAX(case when A.intpreferenceid = 10 then '1'
else '0' end) AS PREFER
FROM CUSTOMER
GROUP BY A.INTCUSTOMERID
ORDER BY A.INTCUSTOMERID
END
WHICH NOW GIVES ME TWO SETS OF DATA , BOTH REQUIRED THEN HOW TO USE ONE SET OF RESULTS AS I/P TO ANOTHER PROC AND OTHER SET OF RESULTS AS I/P TO YET ANOTHER PROC .
CREATE PROCEDURE PROC2
AS
BEGIN
CREATE TABLE #SAATHI(INTCUSTOMERID INT,CHREMAIL NVARCHAR(60),INTPREFERENCEID INT,CHRPREFERENCEDESC NVARCHAR(50))
INSERT INTO #SAATHI
EXEC MY_PROC
ST......1,
ST......2,
END.
BUT, HERE I WANT TO USE FIRST DATASET ONLY , HOW TO USE IT ?
THANKS.
View 4 Replies
View Related
Nov 17, 2005
Ok, when I bind a textbox in my FormView I'm changing the format to
currency (<%# Bind("TotalValue","{0:c}") %>). When I click
Update I get "Input string was not in a correct format" since
TotalValue is Int32 data type.
Shouldn't it convert it back to Int32 when it updates the db? Or do I have to do it manually, and if so how?
View 2 Replies
View Related
Oct 24, 2007
hi there,
the subject line says it all. is there a way to send nicely formatted html email from within a stored procedure that returns a dataset?
thanks!
chris
View 2 Replies
View Related
Apr 13, 2007
Hi~.
First, is it possible to access(read/write) to the excel,csv or my-own-formatted file using OLE DB(SQL Native Client)?
If possible, how?
View 1 Replies
View Related
Feb 27, 2007
In SSRS I am trying to get a textbox value to hold text with a mixture of formatting, along the lines of "name (country)" where the "name" part is bold and the "(country)" is normally formated.
Can anyone help?
Thanks in advance.
View 3 Replies
View Related
Jun 14, 2005
Hi.
1.
Have a query that fetches a real value (e.g. 4.3345643)
Let say the field is called TheReal.
How can I format the value in the select statement so I get a thousand separator(s) and two decimals in the resultset.
2. In the same query I have a left join as well.
Table 2 retur (sometimes) <NULL>.
Is it possible to force this <NULL> value to be a fixed string value instead in the select statement.
View 6 Replies
View Related
Sep 13, 2007
Hello,
I am unable to send a message to a target service on a different SQL Server instance. Using the SQL Profiler, I get the following error from the target machine:
Broker::Connection: Connection handshake failed: An OS call failed: (80090326) 0x80090326(The message received was unexpected or badly formatted.). State 106.
On the initiator side, the transmission_status shows the following error:
An error occurred while receiving data: '64(The specified network name is no longer available.)'.
Any ideas on why the target thinks the message is "unexpected or badly formatted"? Btw, I am specifying the default message type and contract for the services.
Thanks.
View 1 Replies
View Related
Mar 19, 2007
Good morning, all,
I have an Excel workbook that needs to be imported. It has three
sheets, but it's really the first that is giving me fits. Each of the
three worksheets have header info and instructions on the first 8
rows. Worksheet 1 then has, on row 9, the column names for the group
informtion. Row 10 has the group information. Row 11 has detail
column headers. Row 12 and later have detail information. Worksheets
2 and three do not have detail information, just row 9 with the column
names for the group informtion and Row 10 with group information.
Here is how I am thinking of handling this.
Run a script, outside of SSIS to save each sheet as a CSV file to a
folder. I believe that this must be done because some of the first 8
rows are blank and according to the docs, SSIS cannot have blank rows
in imported Excel sheets.
Loop over the files in the folder.
For each file, exclude the first 8 rows.
if the file name is the first worksheet then
get the next two rows and process group info
get the rest of the worksheet and process detail information
if the file name is not the first worksheet then
get the next two rows and process group info
My questions are: Does this seem feasible? Is there an easier way to
do this? Any hints or tricks that might be helpful? Any pitfalls
that I should watch out for?
Thanks so much for any insights,
Kathryn
View 1 Replies
View Related