Inconsistent Return Codes Using BCP

Mar 2, 1999

I apologize for the length of this message, but I think I need to include all this info so that the problem is understood. I am having what appears to be a problem capturing the return code from a failed BCP.


I create a stored proc to use BCP to load a table:

create procedure sp_bcp_load as
declare @RC int
execute @RC = master..xp_cmdshell "bcp JON..W4KPV in e:inetpubftprootfinreslaw4kpv.g4000.data /Sdbmtss1 /m 0 /f d:mssqluserdatafinresW4KPV.fmt /Usa /P /e d:mssqluserdatafinrescp1.err /t""|"" /r
"

select 'Return code from bcp = ', @RC
if @RC <> 0
BEGIN
print 'BCP Error.'
return (8)
END
GO



If I execute the SP, and encounter a transaction log full error, the return code is still zero:


1000 rows sent to SQL Server. 45000 total
1000 rows sent to SQL Server. 46000 total
Msg 1105, Level 17, State 2:
Server 'DBMTSS1', Line 1:

Can't allocate space for object 'Syslogs' in database 'Jon' because
the 'logsegment' segment is full. If you ran out of space in Syslogs,
dump the transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to increase the size of the segment.

(54 row(s) affected)

----------------------- -----------
Return code from bcp = 0




If I execute the SP again, it correctly returns a non-zero value:


Msg 1105, Level 17, State 2:
Server 'DBMTSS1', Line 1:
Can't allocate space for object 'Syslogs' in database 'Jon' because
the 'logsegment' segment is full. If you ran out of space in Syslogs, dump the transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to increase the size of the segment.

(6 row(s) affected)

----------------------- -----------
Return code from bcp = 1

(1 row(s) affected)

BCP Error.



Does anybody have an idea why this behaves this way? Any suggestions on how to trap an error on the first call?

Thanks,
Jon Carter

View 2 Replies


ADVERTISEMENT

Error Messages Of Return Codes Of SQL Installer

Dec 13, 2006

Hi all,

I have one application through which i m installing SQL Server 2005 Express Edition.

If some failure occures, all I get is one exitCode which is a return code of SQL Express installer. Is there any way by which I can find out the exact reason of failure.

One example is error code 28062.

This error code is for "sql is unable to install on compressed folder / drive".



Please help



Thanks and regards,

-Anup

View 1 Replies View Related

Question On Return Codes And Rollback For Stored Procedures.

Oct 19, 2001

I need to execute 10 stored procedures one after the other in a sequence,but need to roll back if any one of them fails and discontinue further execution.Example: if sp#3 fails it should roll back alll the changes made by sp# 1 and sp# 2 and also should not continue executing the rest of them. Any ideas?
Thanks.

View 1 Replies View Related

SQL Server 2012 :: Return Descriptions From Table2 In Same Format As Codes From Table1?

Apr 22, 2015

Table1 contains a CODES column which may store multiple codes separated by commas.

The descriptions for these codes are stored individually in a column in in Table2.

I would like to return the descriptions from Table2 in the same format as the codes from Table1.

Table1 Stores multiple codes per ID in a single column.

ID CODES
-- --------------
01 Code1,Code2,Code3

Table2 Stores the definitions for the codes in Table1

CODE DESCRIPTION
----- ---------------
Code1 Description1
Code2 Description2
Code3 Description3

The tables are what the tables are. Here is what I am trying to accomplish:

ID CODES DESCRIPTIONS
-- ----------------- --------------------------------------
01 Code1,etc Description1,Description2,Description3

I've found two different queries which return each code and associated description by ID in separate rows. Perhaps the next step is to aggregate from this?

View 7 Replies View Related

Can This Be Done Just In Database (I Have Given Codes)

Oct 4, 2006

Hi , I have a database that records the users entrance to a building.The dates are recorded also .I have written some codes that to detect the period of dates that the person has entered.Lets say that a person named as jhon has entered the building on the days 02/08/2006 and 05/08/2006 and 11/08/2006 .Those dates are formated as dd/mm/yyyy . So that john has entered building for 3 times and the periods for the dates are one after another entrance is 3 days + 6 days =9 days .If you divide 9 by 3 we get the arithmetic average number 3 .So that we can say as john visits this building every 3 days and we can guess the next day that he may come. I have coded this and works great .I will paste the codes to the end of my message.But a master programmer friend of mine has said that I should have get this result by without writing code , by just using sql database .But some kind of stored procedure I mustn't use.So that I thought it can be done by views in sqldb .By using sql server enterprise manager I tried to use views but I could not succees. Can anyone guess this ? Here are my vb codes ... database data types : entry_id : int , identity user_id : int movie : nvarchar (50) dateenter : datetime stored procedure that selects the data from db: CREATE PROCEDURE veri_al     (         @user_id int     ) AS SELECT entry_id ,user_id, movie, dateenter from uye_aktiviteleri where (user_id=@user_id) ORDER BY entry_id ASC GO  Code:Dim conn As New SqlClient.SqlConnection         conn.ConnectionString = "data source=localhost;initial catalog=AFM;uid=nusret;pwd=araz"         Dim command As New SqlClient.SqlCommand         command.CommandText = "[veri_al]"         command.CommandType = CommandType.StoredProcedure         command.Connection = conn         command.Parameters.Add("@user_id", SqlDbType.Int, 4).Value = Val(TextBox1.Text)         If Not IsNumeric(TextBox1.Text) Then             Exit Sub         End If         Try             Dim adapter As New SqlClient.SqlDataAdapter             adapter.SelectCommand = command             Dim ds As New DataSet             adapter.Fill(ds, "uyeler")             DataGrid1.DataSource = ds.Tables("uyeler")             Dim recordcount As Integer 'Found the recordcount             recordcount = ds.Tables("uyeler").Rows.Count             Dim mydatarow_ilk As DataRow             Dim mydatarow_son As DataRow             'in stored procedure I used ORDER BY entry_id ASC so that first datarow             'will always be the first visit date and the last record of the             'datarow will be the last visit date             mydatarow_first= ds.Tables("uyeler").Rows(0)             mydatarow_last = ds.Tables("uyeler").Rows(recordcount - 1)             Dim first_date As String             Dim last_date As String             first_date = mydatarow_first("dateenter")              last_date =mydatarow_last("dateenter")             Dim average_ As Integer             'What is the aveare of the visits             ortalama = DateDiff("d", first_date , last_date ) / recordcount             Label2.Text = "Member had visited for " & recordcount & "times"             Label3.Text = "by average he/she comes here " & ortalama & " day to another."             Dim last_time_visit As Integer            last_time_visit = DateDiff("d", last-date , DateTime.Today())             Label4.Text = "Until the last visit it had been" & last_time_visit & " days"             Label5.Text = "Guess for the next visit is" & DateAdd("d", average_ , last_date)             ' MsgBox("average visits" & ortalama & " days" )         Catch z As Exception             MsgBox("error : " & z.Message())         Finally             MsgBox("Successfully calculated")         End Try     End Sub

View 1 Replies View Related

DateTime Inconsistent

Feb 11, 1999

I need some advise on how to check the consistensy of a DateTime attribute.

Some of my Datetime field(s) won't read as a NULL and some does for example:

Select FileNo,DateReceived,DateEntered,DateFU from RECEIVING
where DateReceived is not null and DateEntered is not null and DateFU is not null

I should get several records but the result is zero.

Is there any articles out there about DateTime ?

I appreciate any help.

Thanks

Rey Caunca

View 1 Replies View Related

Inconsistent SQL Results

Apr 11, 2006

HiI have an oddity. If I run a piece of SQL:SELECT EmployeeNo, MailToFROM ST_PPS.dbo.Employeewhere AddedOn BETWEEN '01-jan-2006' and '01-feb-2006'AND MailTo NOT IN ( '3', 'x')order by MailToI get the resultsEmployeeNo MailTo----------- ------608384 1606135 1608689 1609095 1607163 1606165 1606472 1608758 1.....for 2594 rowsIf I create a stored procedure with the same SQL:-CREATE PROCEDURE dbo.PPS_testASSELECT EmployeeNo, MailToFROM ST_PPS.dbo.Employeewhere AddedOn BETWEEN '01-jan-2006' and '01-feb-2006'AND MailTo NOT IN ( '3', 'x')order by MailToGOand run it:-EXEC PPS_testI get three extra rowsEmployeeNo MailTo----------- ------607922 NULL606481 NULL605599 NULL606316 1608871 1607427 1608795 1.....for 2597Does anyone know what is happening here? It appears that the clause:-MailTo NOT IN ( '3', 'x')excludes NULL in raw SQL, but includes NULL (correctly I think) in astored procedure.Chloe CrowderThe British Library

View 5 Replies View Related

Brick Codes

Jul 20, 2005

Hi,I have a table of Locations around the country. My system produces reportsbased on these Locations. I also have a table containing Brick Codes e.g.Brick Post CodeAB51 AB51AB52 AB52AB55 AB55AB56 AB56AL01 AL1AL02 AL2AL03 AL3AL04 AL4How can I compare the first 3 or 4 letters of the postcode in the Locationstable to the corresponding entry in the Brick Codes table so I can add it tomy report?Thanks for your help

View 2 Replies View Related

Inconsistent DTS Error - Help Please

Jul 20, 2005

I get an error every so often with a DTS package on SQL 7. Error asfollows.The connection is currently being used by a task. The connectioncannot beclosed or re-used.This doesn't happen all the time and I can sometimes (more often thannot) get the DTS package to complete in it's entirety.To explain what the DTS package does...Truncate tables in reporting environment(several in a batch)Clear Transaction LogsCopies data from live environment into CSV (for speed)Copies data from CSV files into tables previously truncated.Builds up a table based on the data copied (for reporting)Clear Transaction logsI'm using a pretty basic set up, Connection (1st DB) -> Transformationto CSV -> Transformation to Connection (2nd DB). It seems to fail oneither the first or second transformation at random (?).I've checked the transformations so that they close the connectionafterwards so it should in theory be releasing the CSV files for thenext step. I suspect that there is a timing issue with this. I cancopy the CSV files over, but this is a little sloppy and I wouldprefer not to do it.Any ideas how to find a tidy way to ensure these are closed bothbefore and afterwards ?ThanksRyan

View 2 Replies View Related

ADO Error Codes...

Oct 10, 2006

Hi,

I have another question about ADO (using C++). I have searched the MSDN but I haven't found a answer to my question (maybe I'm just too stupid)... If I make a connection to my SQL Server there may occur some errors, but how to find out what went wrong ?

In terms of code I have e.g. something like that:
try { connection->Open(ConnectionString,Username,Password,ADODB::adConnectUnspecified);
...} catch (_com_error& e) { long numErrors = connection->Errors->Count; for (long i=0; i<numErrors; i++) { ADODB::ErrorPtr pErr = connection->Errors->GetItem(i); ..... }}

Now I could get the error number by pErr->GetNumber().
But with which symbolic constant has this to be compared to find out which error occured ?? I didn't find any...Or is there another better way to do this ?

P.S. I am using SQL Server 2005 Express

View 7 Replies View Related

Inconsistent Results

May 5, 2008

Hi,

I am building a report with a recursive hierarchy for drill-down purposes. The hierarchy is built by querying a SSAS OLAP cube and defining a details grouping for the table/matrix.

Every time I run the report one or more of the leaf members in the recursive hierarchy "jumps" up to the highest level. First I thought that this may be due to the fact that the leafs parents are not part of the returned dataset. However, the queries makes sense and the "offending" members does never contain any data (while the query should return only non empty members) which is why this is a very strange behavior. Furthermore, the "offending" member differs between different executions of the report, despite the fact that the parameters is exactly the same and the cube is untouched between executions.

I am actually pressing "View Report", waiting for the report to execute and when I press "View Report" again, the returned datasets seem to differ, yielding different "offending" members in the report.

When I run the queries individually in the Data-tab in BIDS, the returned datasets are always the same. Execution caching is turned off for the report.

Checking against SSRS's ExecutionLog, the RowCount for consecutive executions with the exact same parameters differ. For example, RowCount:
3094
3080
3079
3088
3087

Why does SSRS behave such inconsistently? Any tips or tricks?

View 3 Replies View Related

Test Sql Codes

Jan 8, 2008



How can I test sql codes and don't want to connect to company database?
My company is using sql server 2000.
Below is the test codes which create a simple table, calculate and just want to check before
writing more complicated codes.

Thanks
Daniel Ku

-------------------------------------------------------------------------------------------------------------------------------



create table EquipmentUptime (
equipmentId int not null
,transactionId int not null
,dateOccured datetime not null
)
go
--
insert into EquipmentUptime values (1,200,'01/01/2007')
insert into EquipmentUptime values (2,200,'01/01/2007')
insert into EquipmentUptime values (3,200,'01/01/2007')
insert into EquipmentUptime values (2,100,'02/12/2007')
insert into EquipmentUptime values (1,100,'02/25/2007')
insert into EquipmentUptime values (3,100,'03/10/2007')
insert into EquipmentUptime values (1,200,'03/14/2007')
go
--
select
equipmentId
,100*(cast((cast(sum(UpDays)as decimal(6,3))/cast(365 as decimal(6,3))) as decimal(4,3))) 'PctUpTime'
from
(
select
c.equipmentId
,datediff(dd,c.[UpDate],c.DownDate) 'UpDays'
from
(
select
a.equipmentId
,a.dateOccured as 'UpDate'
,coalesce(
(select top 1
b.dateOccured
from
EquipmentUptime b
where
transactionId=100
and b.equipmentId=a.equipmentId
and b.dateOccured >= a.dateOccured
order by
b.dateOccured asc
),'01/01/2008') as 'DownDate'
from
EquipmentUptime a
where
a.transactionId=200
) c
) d
group by
d.equipmentId

View 1 Replies View Related

Error Codes?

Jun 28, 2007

My data flow component is throwing an error and the only help I get is the following:



error code: -1071607694

error column: 257



What in the world does this mean? Can it get more cryptic than this?



View 1 Replies View Related

Inconsistent Query Results

Apr 10, 2001

I am running SQL Server 7.0 on NT 4.0. I have created a simple query:

SELECT SUM(month1) As total_month1
FROM eac_manload
WHERE project_number = 8800
and dept IN (50,51,52,55,57,60,61,62,63,64,65,68,69)

I first time I run the query I get the correct result. Subsequent times that I run the query the result is 1 record with a Null value. The data has not changed. If I stop MSSQLSERVER and restart the service I get the correct result the first time and the Null value each time thereafter. Anybody out there with any idea of what is going on here? Any help will be appreciated!!

View 1 Replies View Related

Generating Serial Codes

Jul 29, 2001

Hi,

I have a table with a primary key, what I really need is something like an IDENTITY, but with the character 'X' and the last to digits of the year added on the front. Is there another way to update the field automatically like an IDENTITY would do, automatically incrementing as fields are inserted.

View 1 Replies View Related

Splitting 9 Digit Zip Codes

Jul 6, 2004

hey all
i am stuck with this little problem
I have a table with people's names and addresses and i have one column for the zip codes. sometimes it includes 5 digit zip codes like '70820' and some times it includes all nine digits like '70820-4565'

is there anyway to move the last 4 digits of the long zip codes into a new column? and remove the dash?

thanks

View 6 Replies View Related

Inconsistent SP Performance On Different Servers

Jun 8, 2006

One of my developers recently installed a backup of the production database onto his test site. His test server has the same configuration as the production server.

One of the Stored Procedures that is called takes 1:45 to run on his machine, but only 2 seconds on the production server. This same SP takes only 2 seconds on my development database.

The SP is called iteratively, up to 10 times... to run against 10 separate fields. Depending on a value for a parameter called @CriteriaClassID, depends on which portion of the SP runs.

The significant difference in processing time in itself is baffling (since the servers are same specs / configuration, as far as I can tell, and the data is identical, since he has a backup of the most recent production data).

But more baffling: if, in his data, I switch the values from field 1 to field 2, and vice versa, his results take 2 seconds (switching the values in field 1 to field 2 switches the value in @CriteriaClassID which is passed through to this SP).

It's exactly the same SP; the only difference is that field 1 is processed first, field 2 second, field 3 third etc. On the production site and my development site, it doesn't make a difference in the order they are processed. On his machine it does.

Any ideas? I though perhaps his Indexes were corrupted in the rebuild, but we ran a SQL Server maintenance schedule to clean it up, and no improvement.

This is the SP, if it is of any help:

CREATE procedure [dbo].[st_pull_model_data] @ModelID as integer, @CriteriaID as integer
as

declare @ClientID as integer, @CriteriaClassId as char(1)

/*Procedure to pull data from org_model_data and postalcode_model_data for modeling and media analysis */
/*Need to have table #temp_data created outside of SP with fields org_id and zip_code */
/*This procedure is used by SP st_model_data */

If @CriteriaID is not null
begin

set @CriteriaClassId = (Select model_criteria_type from model_criteria where model_criteria_id = @CriteriaID)
if @CriteriaClassID = 'G' -- changes client_id from specific to general, if General is required.
begin
set @ClientID = 0
end
else
begin
set @ClientID = (Select client_id from model where model_id = @ModelID)
end

If @CriteriaClassId in ('G','P')
Begin
update#temp_data
setdata1 = postal_criteria_value
from #temp_data t
left outer join
(select postalcode, postal_criteria_value
from postalcode_model_data pmd
join model_org_trade_area mota on mota.zip_code = pmd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id
where model_criteria_id = @CriteriaID
and client_id = @ClientID
and mo.model_id = @ModelID) as PMD
onPMD.postalcode = t.zip_code
end
else
Begin
update#temp_data
setdata1 = org_criteria_value
from#temp_data t
left outer join
(select distinct postalcode, org_criteria_value, omd.org_id
from org_model_data omd
join org o on o.org_id = omd.org_id
join model_org_trade_area mota on mota.zip_code = omd.postalcode
join model_org mo on mo.model_org_id = mota.model_org_id and mo.org_id = o.org_id
where model_criteria_id = @CriteriaID and o.client_id = @ClientID and mo.model_id = @ModelID) as OMD
on OMD.postalcode = t.zip_code and omd.org_id = t.org_id
end
end

View 5 Replies View Related

What The Format Codes Mean In SQL 'CONVERT'

Aug 28, 2007

Aloha !

I am posting this information simply as an FYI. This is in reference to the MS-SQL command "CONVERT"

I spent over 2 hours :rolleyes: screwing around trying to find out different ways of formatting dates from MS-SQL into something that makes sense for what I needed. I googled everything I could think of and found multiple references that said the info is available on MSDN.. but I could not find it. What I did find were thousands of relatively useless references to "format codes" for converting dates, but with no references to what the different format codes would ultimately yield, or what format codes were available to use.

What I ended up doing was writing a small script to generate a list of all of the variations I could find.

Below is the script, and the output that it yielded.
Now, before I get bombarded with "there is a better way" I know there probably is. But this is the way that I needed to do it this particular time. If there are technical errors in my explanation, anyone is welcome to correct them. But after 2 hours of messing with this for what should have been a super simple single .0009 second command, I am just irritated beyond belief that it had to be this complicated to find any useful information on the subject. That is why I am creating this. Hopefully it helps someone else.

The format for the MS SQL CONVERT command is :

CONVERT( length_of_output, date, format_code )

length_of_output : is exactly that . the number of characters that you want returned as your result. If you use a length of 6 you will only see the first 6 characters that are returned. I found the longest valid length to be 28 characters, but I went as high as 128 just for giggles and to see if it revealed any secrets.

date : is a valid date, I used directly the getdate() function

format_code : well.. that's the tricky part. See below.

What I did was ran a script that originally went from 1 to 20,000. It crashed at 15. Apparently the format codes are not totally sequential. So I put in an on error resume next.

What I found is that :
1) the codes are not uninterrupted sequential numbers.
2) the code output repeats every 255
3) negative numbers can be used, but its pointless.
4) useful valid codes are in the ranges of : 0-14, 20-25, 100-114, 120, 121, 126, 130 and 131
5) 0-25 typically represent "short dates" with the year being only 2 digits, but there are exceptions
6) 100 and above always returned a 4 digit year. the exception was 130 and 131, I don't know what it was trying to do.

Here is the script i ran

<%
on error resume next

for iintCounter = 0 to 256
SQL = "SELECT CONVERT(CHAR(128), getdate(), " & iintCounter & " ) as TheDate"
Set rsTheDateFormat = TheDatabase.Execute(SQL)

response.write SQL & " = " & rsTheDateFormat("TheDate") & "<br>"

set rsTheDateFormat = nothing
next
%>



and here is the output
SELECT CONVERT(CHAR(128), getdate(), 0 ) as TheDate = Aug 28 2007 6:46AM
SELECT CONVERT(CHAR(128), getdate(), 1 ) as TheDate = 08/28/07
SELECT CONVERT(CHAR(128), getdate(), 2 ) as TheDate = 07.08.28
SELECT CONVERT(CHAR(128), getdate(), 3 ) as TheDate = 28/08/07
SELECT CONVERT(CHAR(128), getdate(), 4 ) as TheDate = 28.08.07
SELECT CONVERT(CHAR(128), getdate(), 5 ) as TheDate = 28-08-07
SELECT CONVERT(CHAR(128), getdate(), 6 ) as TheDate = 28 Aug 07
SELECT CONVERT(CHAR(128), getdate(), 7 ) as TheDate = Aug 28, 07
SELECT CONVERT(CHAR(128), getdate(), 8 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 9 ) as TheDate = Aug 28 2007 6:46:45:507AM
SELECT CONVERT(CHAR(128), getdate(), 10 ) as TheDate = 08-28-07
SELECT CONVERT(CHAR(128), getdate(), 11 ) as TheDate = 07/08/28
SELECT CONVERT(CHAR(128), getdate(), 12 ) as TheDate = 070828
SELECT CONVERT(CHAR(128), getdate(), 13 ) as TheDate = 28 Aug 2007 06:46:45:507
SELECT CONVERT(CHAR(128), getdate(), 14 ) as TheDate = 06:46:45:507
SELECT CONVERT(CHAR(128), getdate(), 20 ) as TheDate = 2007-08-28 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 21 ) as TheDate = 2007-08-28 06:46:45.540
SELECT CONVERT(CHAR(128), getdate(), 22 ) as TheDate = 08/28/07 6:46:45 AM
SELECT CONVERT(CHAR(128), getdate(), 23 ) as TheDate = 2007-08-28
SELECT CONVERT(CHAR(128), getdate(), 24 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 25 ) as TheDate = 2007-08-28 06:46:45.540
SELECT CONVERT(CHAR(128), getdate(), 100 ) as TheDate = Aug 28 2007 6:46AM
SELECT CONVERT(CHAR(128), getdate(), 101 ) as TheDate = 08/28/2007
SELECT CONVERT(CHAR(128), getdate(), 102 ) as TheDate = 2007.08.28
SELECT CONVERT(CHAR(128), getdate(), 103 ) as TheDate = 28/08/2007
SELECT CONVERT(CHAR(128), getdate(), 104 ) as TheDate = 28.08.2007
SELECT CONVERT(CHAR(128), getdate(), 105 ) as TheDate = 28-08-2007
SELECT CONVERT(CHAR(128), getdate(), 106 ) as TheDate = 28 Aug 2007
SELECT CONVERT(CHAR(128), getdate(), 107 ) as TheDate = Aug 28, 2007
SELECT CONVERT(CHAR(128), getdate(), 108 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 109 ) as TheDate = Aug 28 2007 6:46:45:913AM
SELECT CONVERT(CHAR(128), getdate(), 110 ) as TheDate = 08-28-2007
SELECT CONVERT(CHAR(128), getdate(), 111 ) as TheDate = 2007/08/28
SELECT CONVERT(CHAR(128), getdate(), 112 ) as TheDate = 20070828
SELECT CONVERT(CHAR(128), getdate(), 113 ) as TheDate = 28 Aug 2007 06:46:45:930
SELECT CONVERT(CHAR(128), getdate(), 114 ) as TheDate = 06:46:45:930
SELECT CONVERT(CHAR(128), getdate(), 120 ) as TheDate = 2007-08-28 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 121 ) as TheDate = 2007-08-28 06:46:45.943
SELECT CONVERT(CHAR(128), getdate(), 126 ) as TheDate = 2007-08-28T06:46:45.990
SELECT CONVERT(CHAR(128), getdate(), 130 ) as TheDate = 15 ????? 1428 6:46:46:040AM
SELECT CONVERT(CHAR(128), getdate(), 131 ) as TheDate = 15/08/1428 6:46:46:040AM
SELECT CONVERT(CHAR(128), getdate(), 256 ) as TheDate = Aug 28 2007 6:46AM

View 11 Replies View Related

Need To Update Old Area Codes

Jan 29, 2004

I have files with area codes that are several years old. Everything I've seen about updating area codes deals with area codes that are current and are about to split in the near future. How would I go about bringing old area codes up to date?

View 8 Replies View Related

Inconsistent Application Performance

Feb 13, 2007

Basically, I have a web-based application that queries aggregates from several big tables that grow rather quickly. I feel I am fairly accomplished at tuning individual queries and have optimized these particular stored procedures as much as I can and often see great results for a period of time. However, after time passes, it seems the stored procedures begins performing really badly. What's frustrating is that I have traced the server, located a stored procedure that consistently executes with an abnormally high duration, but when I run the exact same text directly against the sql server it returns instantly.

If I recompile the stored procedure using my direct connection by including the WITH RECOMPILE clause to the EXEC statement, the problem remains for the web-app. However, if I add the WITH RECOMPILE to the actual stored procedure, it is instantly resolved. I can then remove the WITH RECOMPILE from the stored procedure text and things will remain speedy for a period of time before they again slip back.

I'm curious as to what I can do from a SQL standpoint to correct for this. For now, the app team is setting a counter for each execution and then issuing a WITH RECOMPILE when the counter limit is exceeded.

I apologize if this question has most been asked before and I have attempted a review of the forums but was unable to find any material. Any suggestions, advice, links or general assistance would be most appreciated.

View 4 Replies View Related

Zip Codes In Lengths Of 9,8,5 And4

May 2, 2007

I am working with a table that has zip codes listed in lengths of 9,8,5 and 4 digits. The table is created this way and I have no way of changing the data outside of SQL. I am trying to get the last four digits off of all the zip codes so that I only have to work with zip codes in lengths of 5 and 4

Thanks,

Pizzo36

View 5 Replies View Related

Most Commonly Billed CPT Codes

Nov 30, 2007

I hope you can help me out here. I don't know if I even have enough information to give you. I need to create a SQL that pulls the most commonly Billed CPT Codes. The Fields that I am going to use is the CPTCODES Field and the DOS FROM Field. How I was going to right my statement is below. Do I need to have a count or anything?


SELECT TOP 100 DOSFROM, DOSThru, CPTCODES
FROM VW_1000_Commonly_Billed_Charges
WHERE (DOSFROM >= @BottomDate) AND (DOSThru <= @TopDate)

View 3 Replies View Related

Inconsistent Database Performance

Jul 23, 2005

Hi,I am facing a peculiar problem while looking ahead in a live Databasecurrently under operation in one of my client’s Project. AnApplication that is updating 3 - tables in the Database is missing toupdate a certain number of Fields in one of the Tables. The fact isnot frequent and I have checked through the Server Performance Monitorthat there is no performance slag of the Server during any point oftime.The Tables are indexed with common Key fields. Can anybody help me inthis regard ?Thanks & Regards.--Posted using the http://www.dbforumz.com interface, at author's requestArticles individually checked for conformance to usenet standardsTopic URL: http://www.dbforumz.com/General-Dis...pict193836.htmlVisit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=655931

View 2 Replies View Related

Store Gitar Codes

Jul 23, 2005

HiIs there any way to store gitar codes in sql server table. or want toset specific "COLLATE".ThanksDishan

View 7 Replies View Related

Distance Between Postal Codes

Jul 23, 2005

I'm looking to find out how I'd go about setting up a database where avisitor to my site could punch in their postal code, and find out how farthey are from another postal code. For example, AutoTrader has this featureI believe to tell you how far the vehicle is from you. Dating sites havethem so you can do proximity searches.Anyone have any ideas where I could start? I'm thinking the post office,but if anyone else has suggestions, I'm open to hear them.Thanks!

View 4 Replies View Related

Setup.exe Error Codes Not In BOL

May 11, 2006

Using the following syntax, sometimes non-zero error codes are returned:
D:SQL Server x86Servers>start /wait setup
D:SQL Server x86Servers>echo %errorlevel%
3010

Searching BOL for 3010 returns nothing.

Other error codes that were seen are 1603 and 9009.

What do these error codes mean? Is there a place where they can be looked up?

View 4 Replies View Related

Custom Formatting Codes

Aug 10, 2007

I need to create formatting that is a bit different from the standard formatting codes in SSRS. Specifically, I need to have the percent sign come right after the number (SSRS inserts a space), whereas with currency fields I need to inster a space between the $ and the number (SSRS has no space). Is there any way to do this with custom formatting codes, or will I need to go through and add the percent and dollar sign in manually to each field so that the space can either be removed or inserted?

View 15 Replies View Related

SSIS Map Error Codes

Oct 3, 2007

I am designing a SSIS package where i get text file as input. This file contains transaction details.

I have to map the members in each transaction for data integrity. For this i am using Lookup object.

Lookup object works very well upto my expectations but i am facing problem in mapping the error code sent bythe this object whenever a record fails. I am storing all the invalid records into text file.

All the records get stored into text file along with some SQL Server error_code and error_column.
I cant interpret these last two columns as it displays some numeric code and column name.

Is there any way to map these error codes and columns and get relevant information out of it?
Example
error code = -1071607778
error column = 0

Any help is appreciated.

View 1 Replies View Related

Possible Setup.exe Exit Codes?

May 8, 2007

As part of our application deployment we have wrapped and automated the SQL Server Express install by launching the setup.exe with our parameters and waiting around for the process to exit.

I had been checking for a Exit Code != 0 to detect errors returned by setup.exe but this does not appear to be foolproof. Several customers' deployments have returned non-zero exit codes, but SQL Express seems to be successfully installed.

I have not found a reference of possible codes returned and their meaning that I could use to fine tune our checking. Does one exist? Or am I going about this the wrong way and should just check for the existence of our instance after setup is complete?


thank you for any input.

View 1 Replies View Related

Inconsistent Performance From Queues

Nov 13, 2006

Hi everyone! I have a very brief question... I have 10 queues in my database and each of them are sent equal number of messages... There are instances where they execute/activate the stored procedures very fast but there are times where they don't, does anyone have an idea why this happens?

Thank you very much for taking the time to read my post. :)

View 10 Replies View Related

Gridview - RowEditing, What Are The Codes?

Mar 23, 2008



Protected Sub gvSales_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvSales.RowEditing

-- What are the codes here??



End Sub


I have a CommandField in my Gridview with the ShowEditButton set as True.

What do I type at the RowEditing so that I can edit the data in any row in my database (SQL Express) displayed in the gridview?



Thanks!!!

View 1 Replies View Related

Inconsistent Sort Orders

Jan 11, 2008

Hello all-
Maybe someone has some insight on this... I currently have some hash values (SHA512 through Enterprise Library) that I'm trying to compare to data in our database. When I sort the values on the pipeline (DT_STR, 1252) with a Sort and compare them against values coming out of an OLE DB Source (SQL_Latin_1_General_CP1_CI_AS) with a Merge Join, any hash that has a '/' in it is treated as inequal to the one in the database.

For even more fun, when I change the sort/merge join to a Lookup, everything (seems) to check out. Is the 1252 code page not the same as SQL_Latin_1_General_CP1_CI_AS? Any other reasons this might be happening?

Cheers,
-Brandon Tucker

View 15 Replies View Related

Error Codes And How To Trap Certain Ones

Apr 10, 2006

I have a system using asp pages & ADO & SQL Server 2000, which processes files, builds a SQL insert statement from the file content and then executes it.

If the insert SQL fails, I need to know whether there was something wrong with the insert SQL, or something wrong with the database (e.g. SQL Server times out), and handle those differently,

Questions
=======
1. Is there an easy way to do this without checking against a list of error codes?
2. Can anyone point me to a list of errorcodes? Can't find this anywhere

thank you

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved