Database Reporting Time Differently Than System

Oct 12, 2004

Hiya,

I have a database on a SQL Server 2000 (sp3a) installation. For some reason it's reporting time that is 7 hours ahead of the system time.

The application is on one server the DB is on a shared production server. The app server and the DB server are reporting the same system time and are using a network time server. All the other db's on the shared production db server are reporting time correctly.

My questions:

Is there a T-SQL query to use to see what the time/timezone is for that database?
Is there a T-SQL query I can use to set the db time (not the system time)?
Anyone have any other suggestions as to what could be wrong?

Thanks in advance for any help!
'chele

View 2 Replies


ADVERTISEMENT

High Insertions / Updates On A System With Real-time / Online / Live Reporting?

Jul 20, 2015

I am trying to understand an environment and provide a solution to Banking system so that they can enter user data (transactions) online and at the same time we can provide users online reporting as well. Using same sql server or server/hardware on other machine.

There are so many branches/customers/ATM machines accessing online data as well as updating their balances. I want to understand how can we provide online reporting. Through replication, transaction log backup, log shipping or what other solution is available. I need to understand this and provide a solution that is already implemented running/successfully. Need some proposals and their pros and cons. cost and maintenance are the constraints with the real time reporting on live system/database.

View 5 Replies View Related

Reporting Services :: SSRS Loses Ability To Delegate User Credentials To Database Time To Time?

Apr 30, 2015

we have problems with our SQL Reporting Service 2012 (SSRS) server . We have setup Kerberos delegation between SSRS and the database server (SQL Server Always-on cluster) so users are authenticated down to the database. The issue occurs from time to time that SSRS loses the ability to delegate the user credentials to the database. At this point in time the Report Server logs contain rejected database connections because of ANONYMOUS logon. After restarting SSRS the problem is gone.

View 2 Replies View Related

How To Get The System Date And Time Into Database

Jun 3, 2007

  Hi, I m using ASP.NET with C#. I m having one field which should store the datetime of the system. The datetime should be automatically stored for that entry when the user submits that record on the click event.Then it should display the date time on the gridview from database.I m using sqlserver 2005 and i have created the stored procedure for the insert command.This
is the sample sp what should be written here to insert system date time
automatically when the user submits the asp.net form ?Is there any code for writing directly in stored procedure or asp.net coding page...  ALTER PROCEDURE [dbo].[StoredProcedure1]@salesid INT OUTPUT,@salesdate datetime,@customername varchar(20)ASBEGINSET NOCOUNT ONBEGIN INSERT INTO sales (customername) VALUES (@customername) SELECT @companyid = SCOPE_IDENTITY()END SET NOCOUNT OFFEND Thanxs in advance...  

View 2 Replies View Related

Insert System Time In Database

Nov 22, 2006

Dear Friends,

I want to insert in my database, in a table field the system time value on that moment.

For example: I want to create the follow stored procedure:



CREATE PROCEDURE TEST

@ID INT

AS

UPDATE TABLE1 SET MyFieldTime=@MySystemTime WHERE MyFieldID=@ID



I want to save in my database th system time...

Thanks!!

View 4 Replies View Related

How To Convert UTC Time (retrieved From SQL) To Local Time In Reporting Services Based On Time Zone

Aug 7, 2007



Hi all,

I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.

I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.

For example if the date is August 07, 2007 10:00 AM UTC,

then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.


Similarly for other Time Zones it should display the time accordingly.

Is this possible in SSRS 2005?

Any pointers will be usefull...

Thanks in advance
sudheer racha.

View 5 Replies View Related

Reporting Services :: Parameter Filters - Start Time And End Time

Sep 14, 2015

At the moment I already added the DataSet I'm gonna be using. I have 2 date parameters Start Time and End Time.

What I would like to do  for the report is to only pull results greater than 48 hours to the report

How can I accomplish this?

View 4 Replies View Related

Reporting Services :: Real Time Reporting In SSRS?

Jun 19, 2015

We've got a requirement to build the real time report. user can browse report at any point of time and need to see the latest data(stock market) in the report.

I've few options down...

1. Directly point to OLTP database as source and write stored procedure to show result set.

2. Replicate the database and write the SP's to reports. To avoid pointing directly to OLTP db.

3. To build the datawarehouse with dim & facts to show it in reports. I prefer this as a standard method, but this would have some latency depending on trasaction load which will differ from the requirement.

View 3 Replies View Related

Getting System Time From SQL Server

Nov 28, 2007

I'm using an Access MDB as a front end to a SQL 7 database. When I place thesystem time in a field in Access, it used the user's clock. I'd like to usethe SQL Server system time, so that the times will be synchronized. Isuppose I can just do a pass-through query with "select getdate()." But Iwas wondering if there was some built-in method, either in Access or SQLServer. I'm concerned about the overhead of running a pass-through queryevery time I need the current time.Thanks.

View 9 Replies View Related

System Time On Sql Server Is Wrong?

Jul 23, 2005

Hello,My sql server 2000 database is on a shared server that I haveabsolutely no control over.When i run query select getdate() it is reporting the wrong time!I am pretty sure that the sql admin changed the date on the server lastnight and now this is happening.Is this possible. Shouldn't getdate() ALWAYS report back the date timein my LOCAL time zone?

View 1 Replies View Related

DTS File Name To Include System Date/Time

Jul 23, 2005

We have an application group that wants to pull date from SQL Server and write it to text file on the server. They want the file format to be 12100_YYYMMDDHHMM.fr1 for one set of data, 12100_YYYMMDDHHMM.fr2 for a second set...and so on. The '12100' is fixed, but the rest of the file name will always have to include the system date/time. Is there an easy way to do this within a DTS package (when writing to the output file)? I would really appreciate help on this. Thank you.

View 1 Replies View Related

Suggestions For A Reporting System

Jul 23, 2005

Hi,We will be developing a management reporting software for a bank. Theuser will see reports that get updated in near real time( e.g. every 5min), with data regarding transaction amounts, etc. across a number ofdimensions such as day, time, region, etc.The dimensions will be hierarchical in nature. So a zone will havestates and a state will have cities.The raw data has to be pulled from several different databases, such asa DB for ATM transactions, another for home loan applications, etc.It should be easy to add customized reports if a different view of thedata is desired.Our clients suggest that we use a tool called Clementine developed bySPSS. But we have the liberty to choose a different tool if that servesour purpose.Clementine seems to allow a data flow to be defined which might be ofuse to pur project. Does anyone have any idea how this could bedifferent from SQL server's Data Transformation Services?Any other thoughts regarding the approach to be taken, will beappreciated.ThanksYash

View 3 Replies View Related

DB Engine :: Time Testing Azure Point In Time Database Restores?

Sep 21, 2015

I need to do a time test for restoring an Azure SQL database from a point in time. Can I automate this through PowerShell.

View 3 Replies View Related

Reporting Services - System Properties

Aug 22, 2007

Folks:

Does anybody know how to modify the "report server system properties" for Reporting services.

I want to change the EnableIntegratedSecurity option to True and it is not allowing me through SQL Server Surface Area Configuration.


Thanks !

View 1 Replies View Related

DB Engine :: System Failure Error Check Policy - Filter By Time Generated?

Jan 17, 2013

I have been searching for a means to change the System Failure Error Check policy that comes as part of the Best Practice policies. I want to look back 24 hours. The WQL query shipped with the policy doesn't have a WHERE clause component that looks at TimeGenerated. That query looks like:

IsNull(ExecuteWql('Numeric', 'rootCIMV2', 'select EventCode from Win32_NTLogEvent where EventCode=6008 and Logfile="System"'), 0)

After searching for an example of how to do this and not finding any that are specific to PBM, I decided to fall back to a very basic approach - use wbemtest.exe to try out where clause additions and see how they work, then plug the result into the policy and see if it works. As a start, I tried the following query using wbemtest.exe:

select Event Code
from Win32_NTLogEvent
where EventCode = 6008
and Logfile = 'System'
and TimeGenerated > '20130101010000.000000–000'

This works great in wbemtest.exe. My next step was to plug this into the policy condition expression as follows: IsNull(ExecuteWql ('Numeric', 'rootCIMV2', 'select EventCode from Win32_NTLogEvent where EventCode=6008 and Logfile="System" and TimeGenerated > "20130101010000.000000–000"'), 0)

When I try to manually evaluate this policy in SSMS, I receive an "Invalid Query" error message.I assume that SWbemDateTime isn't available to use inside Policy Based Management policies. All the examples of how to handle the kind of dynamic date creation I have seen are for use in PowerShell, VBScript, or SSIS. I've played with using DateDiff, DateAdd, and GetDate inside the query string, with no success.

Why does the ExecuteWql above fail?Is it at all possible to dynamically generate a datetime (say, 24 hours ago) as part of the query string parameter of the ExecuteWql call?What might that look like?

View 2 Replies View Related

Stored Procedure For Reporting System Issue

Dec 17, 2003

Is it possible to have single stored procedure which can return Weekly, Monthly, Quaterly and Yearly Report.

User input for Queries:
Weekly : Start Date & End Date
Monthly: Month & Year (Eg. Jan 2003, May 2004)
Quarterly: Quarter & Year (First Quarter 2003, ThirdQuarter 2004)
Yearly: Year

Currently I have 4 different Stored Procedure 1 for each reporting system.

I have seen that one can use CASE in Stored procedure.....

Pls give suggestion !!!

View 20 Replies View Related

Another Reporting System Stored Procedure Issue

Jan 2, 2004

Thx to all who helped me for Stored Procedure previously

Here is what I have:
3 Drop Down Boxes:
1) List of property
2) Ticket Status
3) Tech Name

All 3 Drop boxes have default value of "All"

So, if all 3 drop boxes are "All" ie.

list of property = All
Ticket status = All
Tech Name = All

Query pulls up all records from database and displays it.

Lets say if I select Tech Name is XYZ then query should pull out all property, all ticket status by Tech XYZ.

Now my previous developer has if else case and he has total 9 query for doing all this. He has used SQL along with C# code.

I am trying to modify this if-else and convert it into Stored Procedure. Is there a way I can handle all with 1 stored procedure ?

Previous Reporting works like charm........

View 17 Replies View Related

Id Getting Generated Differently

Apr 13, 2006

Hi,

I created a PDA application with a database, which has a table with a uniqueidentifier field and primarykey.

While doing the bulk insert from dataset into sql mobile database, It is inserting the record but it is not inserting the id which was entered into the sql server 2005 database, instead the id by creating a new id and the code is as below.

conAdap = new SqlCeDataAdapter(strQuery, conSqlceConnection);

SqlCeCommandBuilder cmdBuilder = new SqlCeCommandBuilder(conAdap);

conAdap.Fill(dsData);

int r =conAdap.Update(dsData);

Please help me.

Thank you,

Prashant

View 1 Replies View Related

.NET 1.1 And .NET 2 Perceives DB Data Differently

Feb 5, 2007

I'm hoping someone can help me out - at least by pointing me to who I can ask, if not answering the question directly.
I have some encrypted values in a SQL Server 2000 database that I unencrypt and use in a website that I just converted from .NET 1.1 to .NET 2.
The data is pulled from the database using standard ADO with no changes between the .NET 1.1 version and the .NET 2 version - yet for some data entries, when the identical value is pulled by the .NET 2 code it is changed or shorted.
For example: 
1.1 code traces out a value pulled from the db as:
ᒪ࢖淨�d�把���媑쬹�䜻ꖉ���
The same value pulled from the database by .NET 2 looks like this:
ᒪ࢖淨�d�把媑쬹�䜻ꖉ
Do you know why the database value would be interpreted diferently by .NET 2 than by .NET 1.1? How can I bring this in sync so that both 1.1 sites and 2 sites can use the same data?

View 8 Replies View Related

Print Option Causes System Restart (Reporting Services 2000)

Apr 18, 2007



We are using Reporting Services 2000.

The print button that is present in the browser is working just fine for some users.



But some users are complaining that on clicking the print button their system restarts.



Some other users are also getting the error "An error occurred during printing. (0x80004005)"

However on closing the browser and opening the report in it again this issue is resolved.



So, the main concern is "Restart of the machine on click of the PRINT icon in reports viewed in some application browser."



Please help!!

View 3 Replies View Related

.NET Runtime 2.0 Error Reporting Event Id 5000 System.nullreferenceexception

Aug 29, 2006

I only found http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=389835&SiteID=17 regarding this error message and it was of no help to me.

Background: 3rd party program that extracts users from a AD group and manage user creation i a MSSQL 2000 server. Also sends e-mails using the SMTP service. The funny thing is that the program manages everything correctly, but writes an error in the Event log as it exists (below). Job is scheduled with the SQL server agent and runs with a doamin user that has local admin rights. We have the same setup on a testserver where it runs without problems.

Windows server 2003, MDAC 2.8, SQL Server 2000 SP3, .NET framework 2 on both servers.

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 2006-08-29
Time: 09:16:28
User: N/A
Computer: STHPS0125
Description:
EventType clr20r3, P1 bzadbatch.exe, P2 1.0.0.0, P3 44e5c349, P4 bzadbatch, P5 1.0.0.0, P6 44e5c349, P7 25, P8 308, P9 system.nullreferenceexception, P10 NIL.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 63 00 6c 00 72 00 32 00 c.l.r.2.
0008: 30 00 72 00 33 00 2c 00 0.r.3.,.
0010: 20 00 62 00 7a 00 61 00 .b.z.a.
0018: 64 00 62 00 61 00 74 00 d.b.a.t.
0020: 63 00 68 00 2e 00 65 00 c.h...e.
0028: 78 00 65 00 2c 00 20 00 x.e.,. .
0030: 31 00 2e 00 30 00 2e 00 1...0...
0038: 30 00 2e 00 30 00 2c 00 0...0.,.
0040: 20 00 34 00 34 00 65 00 .4.4.e.
0048: 35 00 63 00 33 00 34 00 5.c.3.4.
0050: 39 00 2c 00 20 00 62 00 9.,. .b.
0058: 7a 00 61 00 64 00 62 00 z.a.d.b.
0060: 61 00 74 00 63 00 68 00 a.t.c.h.
0068: 2c 00 20 00 31 00 2e 00 ,. .1...
0070: 30 00 2e 00 30 00 2e 00 0...0...
0078: 30 00 2c 00 20 00 34 00 0.,. .4.
0080: 34 00 65 00 35 00 63 00 4.e.5.c.
0088: 33 00 34 00 39 00 2c 00 3.4.9.,.
0090: 20 00 32 00 35 00 2c 00 .2.5.,.
0098: 20 00 33 00 30 00 38 00 .3.0.8.
00a0: 2c 00 20 00 73 00 79 00 ,. .s.y.
00a8: 73 00 74 00 65 00 6d 00 s.t.e.m.
00b0: 2e 00 6e 00 75 00 6c 00 ..n.u.l.
00b8: 6c 00 72 00 65 00 66 00 l.r.e.f.
00c0: 65 00 72 00 65 00 6e 00 e.r.e.n.
00c8: 63 00 65 00 65 00 78 00 c.e.e.x.
00d0: 63 00 65 00 70 00 74 00 c.e.p.t.
00d8: 69 00 6f 00 6e 00 20 00 i.o.n. .
00e0: 4e 00 49 00 4c 00 0d 00 N.I.L...
00e8: 0a 00 ..

I'm not a developer, so I'm pretty lost why it behaves like this on one server and not the other. Checked Aspnet.config-file and they are the same. Found this

http://support.microsoft.com/?id=911816

that described that the exception handling was different between the .NET-versions, but since this works on one of the servers, it shouldn't be related, or could it? Tried changing the setting in method 2, but with the same behaviour. Any ideas?

Best regards

/ Jan

View 1 Replies View Related

Order By Caluse Behaving Differently

May 22, 2008

Hi Guys,

There is an int filed in my table called "WeekNo" and when I use order by WeekNo Desc, I am getting the following result.
9
8
7
7
6
5
4
3
2
18
17
16
15
15
14
13
13
12
11
10
10
1

This does not seem right, can anyone comment why i am getting this result.

Many Thanks

View 4 Replies View Related

Transactions/sec Behaves Much Differently In 2005

Aug 6, 2007

Our Transactions/sec counter jumped quite a bit when we moved to SQL Server 2005. The move coincided with increased load so we didn't think anything of it until recently. Upon further review, the counter just seems too high.

There was an article in SQL Server magazine a few years ago by Brian Moran where he states, "Transactions/sec doesn't measure activity unless it's inside a transaction. Batch Requests/sec measures all batches you send to the server even if they don't participate in a transaction." He goes on to say that Transactions/sec will be skewed lower because it is a subset of Batch Requests/sec. (http://www.sqlmag.com/Article/ArticleID/26380/sql_server_26380.html)

The article was written for SQL Server 2000. We conducted tests in 2000 and found what he said to be right on the money. SELECT statements increased Batch Requests/sec, but not Transactions/sec. UPDATE/INSERT/DELETE statements increased both in lockstep. Makes perfect sense so far.

We conducted the same tests in 2005 and found a radically different story. While SELECT statements behaved the same, UPDATE/INSERT/DELETE statements showed Transactions/sec skyrocket 2-10x more than Batch Requests/sec for the duration of the statement. In other words, a single transaction submitted by our application fires off exponentially more transactions than the one we submitted. I was unable to pinpoint exactly what these "hidden" transactions were actually doing. Is this something that occurred in 2000 but simply wasn't reported? Or is it new behavior in 2005?

While trying to answer these questions we noticed a second strange behavior in 2005. When no queries are being executed the Transactions/sec counter still jumps every six seconds like clockwork. And these phantom transactions number in the thousands. We tried to use profiler to capture what SQL was being executed, but nothing shows up in any SQL Statement or Batch event. However, when we turned on the SQLTransaction event we found it, sort of. An object called GhostCleanupTask runs every six seconds causing thousands of transactions. We don't know exactly what it is doing, but we noticed that it ran consistently on some databases, but never on other databases. Both sets of databases are identical and in use.

So, all of this investigation leads me with three final questions.

1. What is behind all the extra transactions caught by perfmon when I submit a single transaction?
2. What is GhostCleanupTask and why does it take so many transactions? (And why does it only run on certain databases?)
3. If a potential customer asks for our Transactions/sec count, is it accurate to give them the big number, knowing that our application is only actually submitting a fraction of that? On the other hand, the system apparently is actually doing that many transactions. (For instance, on our production server during peak, Batch Requests/sec is about 4,000, while Transactions/sec hits 26,000.

Any insight would be much appreciated.

3P

View 1 Replies View Related

SQL Converts Date Differently Than Excel

Feb 19, 2008

I've been trying to find an answer to the mystery of how date conversions differ between SQL server and Excel. In Excel the number 37711 is displayed as the date '3/31/2003'. The same number in SQL server yields '2003-04-02' (I used the following: select cast(37711 as datetime) ).

Any idea what is going on here and how I might resolve this problem?

View 4 Replies View Related

Reports Print Differently On Different Printers

Apr 26, 2007

Has anyone else run into this issue?

Dependingon the printer, the report prints differently. Sometimes it's all messed up on certain printers on others it prints fine. I see the problem mostly with older HP printers..



Any ideas?



Daryl

View 2 Replies View Related

For Xml Statements Behave Differently Under MSDTC

Mar 2, 2007

I have SQL stored proc that calls a CLR function. This function does a "select ... for xml" statement, manipulates the XML a little, and returns the manipulated XML to the stored proc.

This all works fine when I call the stored proc from a query window, but when I have BizTalk call the stored proc, the CLR function fails. I have a feeling this may have to do with BizTalk using MSDTC , but I am not sure.

Here's a code snippet from where CLR function fails:

SqlConnection conn = new SqlConnection("Context Connection=true");
conn.Open();SqlCommand cmd = new SqlCommand("Select * From Items FOR XML AUTO",conn);XmlDocument xdoc = new XmlDocument();xdoc.Load(cmd.ExecuteXmlReader());

Under BizTalk, the last line fails with: System.InvalidOperationException "Invalid command sent to ExecuteXmlReader. The command must return an Xml result."

Now to see why XmlReader doesn't like the returned data, i changed the last 2 lines of that snippet to this:
SqlDataReader dr = cmd.ExecuteReader();

dr.Read();Object obj = dr[0];



If i have a breakpoint after that last line, obj is of type string when i call the proc myself, but it is a byte[] under Biztalk. If i look at the bytes themselves, its close to the expected xml...but with some nontext bytes sprinkled around. I can't seem to cast or encode the byte array into anything useful.

Anyone have any idea what is going on here? Why would the same code return different types based on a) who is calling it, or b) the type of transaction used?

Thanks,
Ron

View 1 Replies View Related

How Are These Queries Evaluted Differently By Sql Server?

Sep 16, 2007

I'm looking for the minimum date of an entry into a history table. The table contains multiple entries for the customer and the item with an activation and deactivation date for each entry.

I could use the following:

select customerId, item, min(activationDate) from history group by customerId, item

or a sub query


select customerId, item, activationDate

from history h1

where activationDate=(select min(activationDate) from history h2 where h2.customerId=h1.customerId and h2.item=h1.item)



How are these two queries parsed differently by SQL.

They return a different number of results.

Thanks,

karen

View 7 Replies View Related

Report Formatting Differently On Different Servers With Same RDL

Mar 5, 2007

This is a good one:

Same RDL, 2 different servers. I run the report on my computer and export to PDF, it prints properly. When the customer runs the report on their server (SSRS 2K5 SP1, same as mine), they get it displayed differently. The columns on the report extend to the next page and the lines are thicker.

Is this a formatting issue on the customer's PC? It uses standard fonts (Tahoma, Sans-serif).

Any ideas?

View 3 Replies View Related

Reporting Services :: Default Path For Saving Reports On File System?

Jun 23, 2015

during period of troubles connecting to Local Servers and Sites location i.e., to [URL], the place where all Reports are saved by default, I have continued to work on some Reports that have been saved to file system of my localhost/developing machine. But, upon recovery of http location, I can not see/open those files?

how to approach those files in order to open them in Report Builder 3.0 and thus, to "save as" them to the http location? Seems that Report Builder has chosen that location, by default, somehow.....

View 2 Replies View Related

SPROC Created Differently Than I Stated In Script?

Oct 31, 2006

I've written a script that should create a SPROC. It does, but I expect the SPROC to contain everything that is bold when I run this script (See below.) It doesnt...when I run the script, it creates the required table, but instead, it gets created with only the italic text. What gives? Please throw me a bone here :)USE [myproject];GOIF EXISTS (  SELECT *     FROM INFORMATION_SCHEMA.ROUTINES    WHERE SPECIFIC_SCHEMA = N'dbo'     AND SPECIFIC_NAME = N'myproject_CreateTable_SendEmail_Errors' )   DROP PROCEDURE dbo.myproject_CreateTable_SendEmail_ErrorsGOCREATE PROCEDURE dbo.myproject_CreateTable_SendEmail_ErrorsASGO/****** Object:  Table [dbo].[sendEmail_Errors]    Script Date: 10/28/2006 05:31:30 ******/IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sendEmail_Errors]') AND type in (N'U'))DROP TABLE [dbo].[sendEmail_Errors]GO/****** Object:  Table [dbo].[sendEmail_Errors]    Script Date: 10/28/2006 05:14:09 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[sendEmail_Errors](    [errorID] [smallint] IDENTITY(1,1) NOT NULL,    [sendToEmail] [nchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,    [timeLogged] [datetime] NOT NULL CONSTRAINT [DF_sendEmail_Errors_timeLogged]  DEFAULT (getutcdate()), CONSTRAINT [PK_SendEmail_Errors] PRIMARY KEY CLUSTERED (    [errorID] ASC)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Error count' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'sendEmail_Errors', @level2type=N'COLUMN',@level2name=N'errorID'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'This table is used to log failed calls to send a verification email to users. No Email was sent to the user.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'sendEmail_Errors'GO USE [myproject]GO/****** Object:  StoredProcedure [dbo].[myproject_CreateTable_SendEmail_Errors]    Script Date: 10/31/2006 01:59:19 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROCEDURE [dbo].[myproject_CreateTable_SendEmail_Errors]AS    

View 1 Replies View Related

Treat Data Differently For Positive Vs Negative #

Oct 11, 2005

Ok, I have a table with IP addresses stored in decimal format using both positive and negative numbers.
The way that they are stored is:
Positve
1 thru 2147483647 = 0.0.0.1 - 127.255.255.255
Negative
-2147483648 thru -1 = 128.0.0.0 - 255.255.255.255
Conversion
positive
x/2^24 . (x/2^24)/2^16 . etc . etc
negative
(x+2^32)/2^24 . ((x+2^32)/2^24)/2^16 . etc . etc

I have a script which works by using UNION and the WHERE statements are x>0 x<0

My problem is I need to use a 3rd party app to run the script (McAfee ePO). McAfee does not recognize the UNION. My question is, can I acheive the same results as the script below, without using UNION.

SELECT ReportFullPathNode.FullPathName,
cast(cast(IPSubnetMask.IP_Start as bigint)/16777216 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216%65536%256 as varchar),
cast(cast(IPSubnetMask.IP_End as bigint)/16777216 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216%65536%256 as varchar),
cast(IPSubnetMask.LeftMostBits as varchar),
IPSubnetMask.IP_Start
FROM IPSubnetMask, ReportFullPathNode ReportFullPathNode
WHERE IPSubnetMask.IP_Start>0 and IPSubnetMask.ParentID = ReportFullPathNode.LowestNodeID
UNION ALL
SELECT ReportFullPathNode.FullPathName,
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)/16777216 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216%65536%256 as varchar),
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)/16777216 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216%65536%256 as varchar),
cast(IPSubnetMask.LeftMostBits as varchar),
IPSubnetMask.IP_Start+4294967296
FROM IPSubnetMask, ReportFullPathNode ReportFullPathNode
WHERE IPSubnetMask.IP_Start<0 and IPSubnetMask.ParentID = ReportFullPathNode.LowestNodeID

View 2 Replies View Related

Trigger Behaving Differently On Multi-row Update

Aug 1, 2007

Let me set the scene:

I have an update trigger on a table. When a specific column is updated, I get the rowid from 'inserted' and then pass it via service broker to another database that will fire off a maintenance routine at a later time. This whole process seems to work fine if I update a single row at a time through Query Analyzer.

During testing (of the service broker part) I found that if in Query Analyzer I run an update that updates all of the records at once, then the trigger seems to fire only once for the entire process, therefore killing the rest of my process.

I would have thought that regardless of how a record was being updated the trigger would fire atomically for each row.

Any guidance on this would be MOST appreciated!

View 20 Replies View Related

Bulk Insert Acting Differently Than Openrowset

Feb 22, 2008

I am trying to import some data from csv files. When I try it using bulk insert I get a conversion error. When I use the exact same format file and data file with an openrowset it works fine. I would prefer to use the BULK insert as I can make some generic stored procedures to handle all my imports and not have to code the column names in the SQL. Any suggestions?



BULK Insert stuff

From 'c:projects estdatalist.txt'

with

(FORMATFILE='c:projects estdatamyformat.xml')


insert into stuff (ExternalId, Description, ScheduledDate, SentDate, Name)

select *

from OPENROWSET (BULK 'c:projects estdatalist.txt',

FORMATFILE='c:projects estdatamyformat.xml')

as t1


The destination table has more columns than the data file. The Field IDs represent the ordinal position of the columns in the destination table. Column 1 in the destination table is an int identity. The conversion failure is from trying to convert column 5 to int which makes me think bulk insert is ignoring the name attributes in the XML and just trying to insert the columns into the table in order without skipping.

<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="12"/>
<FIELD ID="5" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="200" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="7" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="24"/>
<FIELD ID="8" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="24"/>
<FIELD ID="9" xsi:type="CharTerm" TERMINATOR="
" MAX_LENGTH="500" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
</RECORD>
<ROW>
<COLUMN SOURCE="2" NAME="ExternalId" xsi:type="SQLINT"/>
<COLUMN SOURCE="5" NAME="Description" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="7" NAME="ScheduledDate" xsi:type="SQLDATETIME"/>
<COLUMN SOURCE="8" NAME="SentDate" xsi:type="SQLDATETIME"/>
<COLUMN SOURCE="9" NAME="Name" xsi:type="SQLVARYCHAR"/>
</ROW>
</BCPFORMAT>

View 1 Replies View Related







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