mardi 8 décembre 2009

the query did it

Creating a query tu update a field in a new table with the same data to be filled in with.

--== the query who did the miracle
select 'update operator set operation = %' + Operation+'%', 'where id = ',' ' +id+'','%' from mySourceDataBase.dbo.Operator

--== the result

update operator set operation = '{0}.Contains("{1}")' where id = 1
update operator set operation = '{0}.NotContains("{1}")' where id = 2
update operator set operation = '{0}.StartsWith("{1}")' where id = 3
update operator set operation = '{0}.EndsWith("{1}")' where id = 4
update operator set operation = '{0} == "{1}"' where id = 5
update operator set operation = '{0} != "{1}"' where id = 6
update operator set operation = '{0} > "{1}"' where id = 7
update operator set operation = '{0} < "{1}"' where id = 8
update operator set operation = '{0} >= "{1}"' where id = 9
update operator set operation = '{0} <= "{1}"' where id = 10
update operator set operation = '{0} == ""' where id = 12
update operator set operation = '{0} != ""' where id = 13
update operator set operation = '{0} == {1}' where id = 18
update operator set operation = '{0} != {1}' where id = 19
update operator set operation = '{0} > {1}' where id = 20
update operator set operation = '{0} < {1}' where id = 21
update operator set operation = '{0} >= {1}' where id = 22
update operator set operation = '{0} <= {1}' where id = 23
update operator set operation = '{0} == DateTime.Parse("{1}")' where id = 31
update operator set operation = '{0} != DateTime.Parse("{1}")' where id = 32
update operator set operation = '{0} > DateTime.Parse("{1}")' where id = 33
update operator set operation = '{0} 'fickler' where id = 34
update operator set operation = '{0} >= DateTime.Parse("{1}")' where id = 35
update operator set operation = '{0} <= DateTime.Parse("{1}")' where id = 36
update operator set operation = '{0} = {1}' where id = 57
update operator set operation = '{0} <> {1}' where id = 58

lundi 7 décembre 2009

few sql tips

How to count instances of character in SQL Column

I have an sql column that is a string of 100 Y or Ns eg 'YYNYNYYNNNYYNY...'

What is the easiest way to get the number of Ys in each row


SELECT LEN(REPLACE(myColumn, 'N', '')) FROM ...

LEN(REPLACE(ColumnName, 'N', '')) as NumberOfYs

2. Trouble inserting data

INSERT INTO DestinationTable
(ColumnA, ColumnB, ColumnC, etc.)
(ColumnA, ColumnB, ColumnC, etc.)

And my source table has 22 million rows.

SQL server fills up my hard drive, and errors out.

Why can't SQL server handle my query?

Should I use a cursor and insert a row at a time?

the solution

INSERT INTO DestinationTable
(ColumnA, ColumnB, ColumnC, etc.)
SELECT TOP 100000 ColumnA, ColumnB, ColumnC, etc.
FROM SourceTable
FROM DestinationTable
WHERE DestinationTable.KeyCols = SourceTable.KeyCols)

INSERT INTO DestinationTable
(ColumnA, ColumnB, ColumnC, etc.)
SELECT TOP 100000 ColumnA, ColumnB, ColumnC, etc.
FROM SourceTable
FROM DestinationTable
WHERE DestinationTable.KeyCols = SourceTable.KeyCols)

jeudi 3 décembre 2009

javascript quick short ones

Getting the elements by Id

var btn = document.getElementById(btnName);
if (btn);

mardi 1 décembre 2009

Xtreme Programming

I found a list of small details on Extreme programming the current methodology used by the company Im working on.
I took some list since I want to check it out through my blog instead of a link. heres the link

Extreme Programming
Extreme Programming (XP) is a lightweight process
Ground rules:
  • small team (2 to 12)
  • continuous access to customers
  • OO design and code (Smalltalk, Java)
  • change management system (code and tests)
  • the system is always “working” (growing functionality over time)
  • overall development cycle – between 4 and 12 months
  • new release to customer every 2-3 months
  • internal iterations every two weeks
  • not for life-critical systems (heart monitor, nuclear power plant, avionics systems, etc.)

Some Rules of Extreme Programming

Planning rules
  • do project planning via “user stories”
  • plan a series of very small internal releases
  • start each day with a “stand-up meeting”
Design rules
  • keep the design simple (use the simplest thing that could work)
  • refactor as needed
Coding rules
  • talk with the customer throughout the coding process
  • always code in pairs
  • code unit tests first
  • follow coding standards
Testing rules
  • unit tests for all code
  • acceptance tests for each user story

Information on XP

  • Extreme Programming Explained (Kent Beck)
  • Planning Extreme Programming (Beck and Fowler)
  • Questioning Extreme Programming (McBreen)
Web sites:

A day in the life of an XP developer

First thing in the morning: developer attends a stand-up meeting with the rest of the team (10-15 min)
  • developer chooses a task (part of a user story); chooses a development partner for the day
Developer and partner sit together and do the development work for the task
  • write new unit tests, check them into the change management system
  • write new code, check it in
  • fix things that need to be changed in existing code; rerun the unit tests
  • run the new unit tests; run the acceptance tests for the user story
Developer goes home at 5:00 (no overtime)

Planning an XP project

User Stories
  • Capture requirements “in the users’ words”
  • Small, discrete, testable
  • Include scenarios
  • May include business interactions outside system
“Planning Game”
  • Users own stories
  • Developers set and own estimates
  • Users set priorities – “business value”
  • Joint goal: group stories into iterations
  • Business value
  • “Worst first”

Planning an XP project

  • Interview the customer; write user stories on index cards
  • Developers give development estimates for each story
    • estimates in “ideal person-days”
    • estimates based on experience with similar problems
  • If a story is too big, split it into smaller stories
  • Create a release plan – list the stories in each release
    • highest priority or “risky” items early
  • Track execution of the plan
    • Post the user stories on a bulletin board (in time order)
    • Check off each user story after the code is complete and the acceptance tests have passed

Examples of User Stories


Pair Programming

One important practice in XP: all code is reviewed as it is written
  • how does pair programming work?
    • two developers, one workstation
    • one person is the driver, the other is the navigator
    • the navigator suggests design alternatives, checks for conformance to coding standards, prevents driver from writing unreadable code
    • pair assignments usually change every day
  • reduces the need for elaborate design documentation
  • pair programming actually improves productivity

Agile characteristics

Most of the agile processes are “controlled chaos”:
  • short development iterations, with product “shipped” to either a customer or a pseudo-customer at regular intervals
  • continuous testing – such as daily regression tests
  • collecting customer requirements using scenarios or use cases
  • small team sizes
  • informal modeling techniques – CRC cards, simple drawings on whiteboards
  • adaptive planning techniques – plans are updated based on intermediate results and reprioritization by the customers

Agile versus XP

Most agile process are less radical than XP:
  • don’t require pair programming
  • multiple roles, not just “general-purpose developer”
  • various methods of iteration planning
  • existing heavyweight processes can be adapted to be more “agile”

Which agile process?

  • Scrum is a very general iteration management process, which can be used in conjunction with any methodology
  • development activities are in 30-day “sprints”
Adapt existing processesCrystal Clear
  • much lighter than XP, but the team must define their own “required project documentation”
  • see Agile Modeling by Scott Ambler for ideas
  • good for a team of 4 to 6 people

Books on Agile Processes

  • Crystal Clear: Writing Effective Use Cases (Cockburn)
  • Scrum: Agile Software Development With Scrum (Schwaber and Beedle)
  • Adaptive Software Development: Adaptive Software Development (Highsmith)
  • DSDM: DSDM, Dynamic Systems Development Method: The Method in Practice (Stapleton)
  • Lean Development: Lean Development: A Toolkit for Software Development Managers (Poppendieck)

by David Laurance / Dennis Mancl

lundi 30 novembre 2009


About how sometimes we don't pay attention to what our body is saying. I'm still thinking that we are like any other job part, we depend on our hands to work and if we abuse from our body we will pay the price highly.

here's a link to SO over the question.

mercredi 25 novembre 2009

here they are Semantics.

speaking about semantics...heres a short example.

class car {
int wheels = 4;
string engine;

car mybike = new car();
mybike.wheels = 2;
mybike.engine = null;

The code is error-free, but is semantically incorrect. It reflects poorly on the programmer

jeudi 19 novembre 2009

IIS over Home Basic Windows Vista

I found a guy on the web while i was searching for some sutff who asked this error over windows vista basic. I guess the guy wanted to deploy a website in his machine or some other end-user.
So i thought I would be good to point to wich features the IIS 70 would be enable at:

Depending on which version of Vista you have, install ASP or upgrade to a version which supports IIS.

  • Windows Vista Home Premium Edition
  • Windows Vista Professional Edition
  • Windows Vista Ultimate Edition

mercredi 18 novembre 2009

Adding a value with Insert instead of Add method

Adding a value with Insert instead of Add method, wich gets me to the index, as an first argument
and the text as second argument.

var query = from filtxxxr in db.Entity
where fxxxr.Page == thispage
where fixxxr.Shared || filterUser > 0
orderby descending
select new
DropDownList.DataSource = query;
DropDownList.Items.Insert(0,"No Applied Filter");
DropDownList.DataValueField = "id";
DropDownList.DataTextField = "Name";

mardi 17 novembre 2009

formating a datetimepicker

Some times we want to give a certain format on a datepicker control that we created. here's a quick example

private void picker_Loaded(object sender, RoutedEventArgs e)// the datapicker's load event.
this.picker.Text = DateTime.Now.ToString("dd-MMM-yyyy");

private void picker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
this.picker.Text = this.picker.SelectedDate.Value.ToString("dd-MMM-yyyy");

a quit of a short example

var valueDate = valueDatePicker.SelectedDate.Value.ToString("s");

returns the set with the ISO format (yyyy-mm-dd)

vendredi 13 novembre 2009

list of Code answers by Scott Hanselman's

I was looking at SO for a few things over linq when it came to my face a questino about and interview to a .net developer.. and then digging a bit into the question I found this list at Scott Hanselman's Blog.. i took a piece of the entry for my quick reference.. but there is a few sections that can be useful. Check it out if you want to see the whole list.

What Great .NET Developers Ought To Know

Everyone who writes code

  • Describe the difference between a Thread and a Process?
  • What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
  • What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
  • What is the difference between an EXE and a DLL?
  • What is strong-typing versus weak-typing? Which is preferred? Why?
  • Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
  • What is a PID? How is it useful when troubleshooting a system?
  • How many processes can listen on a single TCP/IP port?
  • What is the GAC? What problem does it solve?

Senior Developers/Architects

  • What’s wrong with a line like this? DateTime.Parse(myString);
  • What are PDBs? Where must they be located for debugging to work?
  • What is cyclomatic complexity and why is it important?
  • Write a standard lock() plus “double check” to create a critical section around a variable access.
  • What is FullTrust? Do GAC’ed assemblies have FullTrust?
  • What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
  • What does this do? gacutil /l | find /i "Corillian"
  • What does this do? sn -t foo.dll
  • What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
  • Contrast OOP and SOA. What are tenets of each?
  • How does the XmlSerializer work? What ACL permissions does a process using it require?
  • Why is catch(Exception) almost always a bad idea?
  • What is the difference between Debug.Write and Trace.Write? When should each be used?
  • What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
  • Does JITting occur per-assembly or per-method? How does this affect the working set?
  • Contrast the use of an abstract base class against an interface?
  • What is the difference between a.Equals(b) and a == b?
  • In the context of a comparison, what is object identity versus object equivalence?
  • How would one do a deep copy in .NET?
  • Explain current thinking around IClonable.
  • What is boxing?
  • Is string a value type or a reference type?
  • What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
  • Why are out parameters a bad idea in .NET? Are they?
  • Can attributes be placed on specific parameters to a method? Why is this useful?

jeudi 12 novembre 2009

ItemDataBound, ItemCommand

Here are some differences between the ItemDataBound and the ItemCommand.

ItemBound is fired when each and every record is binded with the datagrid.
ItemCommand will be fired when the control in datagrid is operated.

The ItemCreated event fires once for every DataWebControlNameItem added to the data Web control. It fires before the DataWebControlNameItem's DataItem property is assigned. The ItemDataBound event also fires once for every DataWebControlNameItem added to the data Web control, but this event fires after the DataWebControlNameItem's DataItem property is assigned. Finally, the ItemCommand event fires whenever the Command event for a Button or LinkButton within the data Web control fires

mercredi 11 novembre 2009

getting done things

public static string GetFilterExpression(int filterId)
var db = new UserQuery();
var filter = db.Filters.Single(f => f.Id == filterId);
var filterExpressions = filter.FilterExpressions;
var expressions = new List();
foreach(FilterExpression expr in filterExpressions)
expressions.Add(string.Format(expr.Operator.Operation, expr.ColumnName, expr.Value));
string logicalOperator = (filter.MatchAll) ? " AND " : " OR ";
return String.Join(logicalOperator, expressions.ToArray());

mardi 10 novembre 2009

Die Mauer ist gefallen

Yesterday was the 20th anniversary of the fall of the wall of Berlin.
I was watching "Good Bye Lenin" a movie who has captured me from it's narrative, a bit pop a few may say but a telling of a change. I wonder how was to live in an enviroment like that. Still more to come for the humanity.

Here is a link I found releted to the activities..

Here is a link from the embassy in my country:

samedi 7 novembre 2009

Controls and differente stuff

i found a few stuff going around in these days.. here are some new stuff to me , from 2.0 and 3.5

Hide SideBar of Wizard Control

<asp:Wizard DisplaySideBar="false" >

applying validation group to previous and next button in a wizard control

vendredi 6 novembre 2009

about how to calculate a checkin -checkout at nights

the solution to the date is like these in the case we just care for the entrance.

jeudi 5 novembre 2009

Changes with a list

Inserting from the entity with a list.

foreach(ListItem itemlist in MyListBox.Items)
db.MyEntities.InsertOnSubmit(new MyEntity()
Id = variableId,
name = itemlist.Value

with a child:

foreach (ListItem col in SListBox.Items)
newentityMaster.Childentity.Add(new Childentity {
FilterId =,
ColumnName = col.Value,


getting my changes performed (DML, insert, delete, updates).


Visual Studio ShortCuts

Here are some helpful keyboard shortcut keys for Visual Studio 2008. You probably know most, but some you won't know. For instance, did you know that Ctrl+. is the same as Sift+Alt+F10?

Note: Some of the shortcuts won't work in all environment configurations (web, C#, etc).

To use, hold down the control key and hit the key combination. Works on the whole document, a specific line, or a selection of code.

Update References/ Add Using Statement (Ctrl +. or Shift +Alt +F10)
I'm referring to the underline that appears under a variable to perform an action like add a using statement, or refacter a method or class name. Not sure what it's called but I use it all the time. Ex:ClassName

List Members (Ctrl +J or Ctrl +K, L)
Displays the autocomplete list for classes, methods, or properties.

List Parameter Info (Ctrl +Shift +Space or Ctrl +K +P)
Lists the parameters for a method. Use this shortcut when your cursor is inside the parenthesis of a method.

Auto Format (Ctrl +K, D or Ctrl +E, D)
Formats C#, VB, ASPX, Javascript, CSS, XML, XSL, and HTML code according to generally accepted formatting standards for the respective programming language. Makes code look nice and neat.

Quick Watch (Ctrl +Alt +Q)
Highlight some code and hit these shortcut keys to display the Quick Watch dialog.

Comment / Uncomment (Ctrl +K, C / Ctrl +K, U)
Comments or uncomments a block of code. Works with C#, VB, ASPX.

Code Bookmarks
Use these to bookmark a line of code. You can cycle through the bookmarks across any file within a project. Bookmarks come in very handy, try it out.

Set/Unset Bookmark (Ctrl +K, K)
Next Bookmark (Ctrl +K, N)

Surround With (Ctrl +S)
Surrounds a block of code with a code snippet.

Build & Debug Shortcuts
Set/Unset Breakpoint (F9)
Build (F6 or Ctrl +Shift +B)

Start Debugging (F5)

Start Without Debugging (Ctrl +F5)

Stop Debugging (Shift +F5)

Continue (F5)

Step Over (F10)

Step Into (F11)

Step Out (Shift +F11)

mercredi 4 novembre 2009

error on Membership.GetAllUser();

Error calling the method GetAllUser(); this was caused by the fact that i was not having a membership provider for the test application.

listbox.DataSource = Membership.GetAllUsers();

so here's the code snippet used to solve the fact

lundi 2 novembre 2009

order by in LINQ (basic example)

I have a table of filters from wich I want to get my last ID inserted , so I thought that I would sort in descending first and get the first element of the list.

Here's how to do a simple task like this.

var firstFilter = db.Filters.OrderByDescending(f =>;

lundi 26 octobre 2009

Creating an insertion from a Table with Select

trying to insert to an Opertor TABLE that has values already in with another Type wich I'm setting as constant.

SELECT 'insert into Operator Values('+','+ Name +','+ 2 as TypeID ,Operation as Operation from dbo.Operator

From the Result of the query (grid or text) you can apply the result with in Linqpad or Sql management Studio.

jeudi 15 octobre 2009

droping all connections with sql server

you can kill all the processes using a database:

USE master

DECLARE @dbname sysname

SET @dbname = 'name of database you want to drop connections from'

DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid

If you want to drop all the connections to a database immediately

USE master

ALTER DATABASE database name
ALTER DATABASE database name

or if you are in a hurry there is an option that says"drop all database connections" as a checkbox in the window displayed for the detach task and you just check it and does close the connections.

mardi 13 octobre 2009


This is what it says in Oracle site. So that's the end point of it. Here are the examples

Using Join Queries: Examples The following examples show various ways of joining tables in a query. In the first example, an equijoin returns the name and job of each employee and the number and name of the department in which the employee works:

SELECT last_name, job_id, departments.department_id, department_name
FROM employees, departments
WHERE employees.department_id = departments.department_id
ORDER BY last_name;

Using Self Joins: Example The following query uses a self join to return the name of each employee along with the name of the employee's manager. A WHERE clause is added to shorten the output.

SELECT e1.last_name||' works for '||e2.last_name
"Employees and Their Managers"
FROM employees e1, employees e2
WHERE e1.manager_id = e2.employee_id
AND e1.last_name LIKE 'R%';

for more info go to :

Examples taked from the site.

System Provider

If you are using 1.1 then go to your machine.config file and in process model section try to chnage user name as "system";

if you are in 2.0 version do the same thing some times you might not find the process model section at all then try add the same section it self.

you can find out the machine.config file in the following location:for 2.0 version i think u are using 2.0


System. Debug

Oracle 10g with C# &

Now I'm trying to use Entity Framework to connect to an Oracle database with C#. Will see how it goes with this ad and free spacing.

Tools to be used for the test.

- Oracle 10g Express.

- Visual Studio.Net

jeudi 8 octobre 2009

Response to Grid backcolor in Row With Ajax

Issue: want to differentiate from one row to another with slight color.

on a different way:

protected void RadGrid1_PreRender(object sender, EventArgs e)
foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
if (dataItem.Expanded)
GridNestedViewItem nestedItem = dataItem.ChildItem;
Panel panel = (Panel)nestedItem.FindControl("PanelID");
if (dataItem.ItemType == GridItemType.AlternatingItem)
panel.BackColor = System.Drawing.Color.Gray;
if (dataItem.ItemType == GridItemType.Item)
panel.BackColor = System.Drawing.Color.White;

on the server side:

protected void Page_Load(object sender, EventArgs e)
var radAjaxManager = RadAjaxManager.GetCurrent(Page);
radAjaxManager.ClientEvents.OnResponseEnd = "gridRowColor";

vendredi 2 octobre 2009


Anthroposophy, a spiritual philosophy based on the teachings of Rudolf Steiner, postulates the existence of an objective, intellectually comprehensible spiritual world accessible to direct experience through inner development—more specifically through cultivating conscientiously a form of thinking independent of sensory experience. In its investigations of the spiritual world, anthroposophy aims to attain the precision and clarity of natural science's investigations of the physical world. Whether this is a sufficient basis for anthroposophy to be considered a spiritual science has been a matter of controversy

Taked from wikipedia.

jeudi 1 octobre 2009

Linq with Outer Join, Ternary and orderby with linq

var query = from lfp in db.LogFundingPrograms
join rc in db.RefCycles on lfp.CycleId equals rc.CycleId
into JoinedRc
from rc in JoinedRc.DefaultIfEmpty()
join rf in db.RefFrequencies on lfp.Frequency equals rf.FrequencyId
orderby lfp.LogFundingId descending
select new
LogActionDescription = lfp.RefLogAction.Description,
CycleDesc = lfp.CycleId != null ? rc.CycleDesc : "",

as you can see the CycleDesc comes with a empty string if the CycleId doesn't bring a value since can be null.

mardi 22 septembre 2009

Left Join, Right Join Using LINQ

How we can handle a trouble when passing a left or Right join within the context of Linq?

var LeftJoin = from t1 in Table1
join t2 in table2
on t1.ID equals t2.ID into JoinedT
from T2 in JoinedT .DefaultIfEmpty()
select new
T1 = T1.Name,
T2 = description

to make the same to Right join just invert the side of the Join

vendredi 18 septembre 2009

cracking a router

Originally Posted by thorin View Post
What are you hoping to learn/prove from doing this? Do you really think all those dictionaries exist online because they don't work? Do you somehow not believe that password policies exist for a reason?

Just crunch the numbers. The dictionary to store all 9 character passwords with all printable characters in is basically impossible to store:
or would take too long to compute on the fly. So unless you have the solution to free & clean energy and aren't sharing AND the CIA/NSA etc know you're hiding it, you have nothing to worry about, apply standard password policies and save yourself a lot of wasted time.

The end goal here is: A friend of mine has invited me to see how secure his WEP network is, with a dictionary-word-based router password.

I just think it's a waste of time to begin with alphanumeric plus symbols when many networks will merely use lower-case alphabetic passwords.

Certainly it's faster to go through dictionary words and then try them with numerical suffixes, versus a brute-force.

jeudi 17 septembre 2009

triggers with a computed column insertion

I had the problem of inserting a row from a table to another because of a computed column cannot have a explicit value on a insert statement. Then I realize i had to take off the name of the column (computed column) in order to insert the row. I make sense , but since I'm pretty scat this things could happen.

the error was resolved with the following trigger code:

CREATE TRIGGER insertanotaVario

on NotaIngreso

select (idnota,notadescripcion, curso1, curso2, curso3)

// Note: do not add the field that is the average calculated from the column(computed column).

mardi 8 septembre 2009

Decimal vs Float (Single) or Double

When you need to deal with a number that is a fraction, what do you specify for its type? If you are like most programmers I know, you’ll reach for Float (Single if you are using VB) or Double.

If you are working with currency, though, this could get you into a lot of trouble.

Here’s why.

When you store a number into a float, you are not storing an exact number. This is because the number you are storing is an approximation of the number you entered. When you store a number, the integer portion of the number gets priority and the fractional part gets entered as close as is possible given the size of the type you are storing it as.

That is, a Double will be able to save the information more accurately than the Float, but neither of them will store the information precisely.

And that’s just storing a number we enter directly. What happens if we need to multiply or divide that number?

For simplicity, let’s just say we need to divide a dollar by three. How would that get stored accurately into a float or a double? The answer is that it won’t. It will store as many threes on the right side of the decimal as possible.

This is what the Decimal data type was created for. A decimal data type deals with the data more like we would if we were dealing with the problem with paper and pencil. In effect, a decimal data type is similar to an integer that has a decimal point.

taked from :

lundi 7 septembre 2009

Posteando en StackOverflow

Esta era mi pregunta

I want to convert my float field into a decimal field; I want a precision of 11,2 in my decimal field, but when I tried to change the type of my field(example: Amount) I get an error: "Arithmetic overflow error converting float to data type numeric. The statement has been terminated." My field is decimal(11,2) at the table, and my max and min values are: 1,603,837,393.70 < -- > -1,688,000,000.00(amount).
select Id,AccountId, cast(Amount as decimal(12,2)) as Amount,
(AmountB as decimal(12,2)) as AmountB
FROM myTable

Esta fue la respuesta.

But a value of "1,603,837,393.70" would require decimal(12,2) - 12 digits in all, 2 after the decimal point.

Maybe you misinterpreted the way the decimal(11,2) works? This would mean total of 11 digits - 9 to the left, 2 to the right of the decimal point.

See the MSDN docs for decimal and numeric types:

decimal[ (p[ , s] )] and numeric[ (p[, s] )]

p (precision)

The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.

vendredi 4 septembre 2009

con un poco de paciencia....

hoy me encontre esta imagen , que tome antes de salir de ICASA.... ah como pasa el tiempo.

Brayan Recinos Corado
Ingenieria de Software
Unidad de Servicios Compartidos
( (+502) 66209720 Ext. 113176

¡Cuenta con Nosotros, nuestra pasión es servirte cada día mejor!

traduciendo de vb for aplications a t-sql (ver. 1)

el query de la macro sin el valor de cadena que nos enviand en el texto.

qry = " SELECT GLProcessEntry.ProcessEntryId, GLAccount.MethodId, GLAccount.AccountId, GLAccount.OffSetAccountId,GLProcessEntryDetail.CcyAmount, "
qry = qry & " GLProcessEntryDetail.CADAmount, PeriodCcyRate.Quote, Round([CCyAmount]*[Quote]-[CADAmount],2) AS EntryAmount "
qry = qry & " FROM CfgCieMethodQuoteStatus,GLAccount,GLProcessEntry,GLProcessEntryDetail,PeriodCcyRate "
qry = qry & " WHERE GLProcessEntry.ProcessEntryId = GLProcessEntryDetail.ProcessEntryId "
qry = qry & " AND GLAccount.CieId = GLProcessEntry.CieId "
qry = qry & " AND GLAccount.AccountId = GLProcessEntryDetail.AccountId "
qry = qry & " AND GLAccount.CCy = PeriodCcyRate.Ccy "
qry = qry & " AND GLProcessEntry.PeriodId = PeriodCcyRate.PeriodId "
qry = qry & " AND CfgCieMethodQuoteStatus.QuoteStatusId = PeriodCcyRate.QuoteStatusId "
qry = qry & " AND CfgCieMethodQuoteStatus.MethodId = GLAccount.MethodId "
qry = qry & " AND CfgCieMethodQuoteStatus.CieId = GLAccount.CieId "
qry = qry & " AND GLProcessEntry.ProcessEntryId=" & ProcessEntryId
qry = qry & " AND GLAccount.MethodId=" & MethodId
If MethodId = 1 Then
qry = qry & " AND GLPRocessEntryDetail.AmountTypeId = 0 "
qry = qry & " AND ((Round([CCyAmount]*[Quote]-[CADAmount],2))<>0)"

qry = qry & " AND GLPRocessEntryDetail.AmountTypeId = 1 "
qry = qry & " AND ((Round([CCyAmount]*[Quote]-[CADAmount],2))<>0)"
End If

la traduccion al t- sql

SELECT GLProcessEntry.ProcessEntryId, GLAccount.MethodId, GLAccount.AccountId, GLAccount.OffSetAccountId,GLProcessEntryDetail.CcyAmount,
GLProcessEntryDetail.CADAmount, PeriodCcyRate.Quote, Round([CCyAmount]*[Quote]-[CADAmount],2) AS EntryAmount
FROM CfgCieMethodQuoteStatus
INNER JOIN PeriodCcyRate on CfgCieMethodQuoteStatus.QuoteStatusId = PeriodCcyRate.QuoteStatusId
INNER JOIN GLAccount ON CfgCieMethodQuoteStatus.MethodId =GLAccount.MethodId
INNER JOIN GLProcessEntryDetail ON GLAccount.AccountId=GLProcessEntryDetail.AccountId
INNER JOIN RefCompany ON RefCompany.CieId = CfgCieMethodQuoteStatus.CieId
INNER JOIN RefDivision ON GLAccount.DivisionId = RefDivision.DivisionId
INNER JOIN GLProcessEntry ON GLProcessEntry.PeriodId = PeriodCcyRate.PeriodId
AND GLProcessEntry.ProcessEntryId = GLProcessEntryDetail.ProcessEntryId
WHERE GLPRocessEntryDetail.AmountTypeId = 0
and GLProcessEntry.ProcessEntryId = 169
AND GLAccount.MethodId = 1
and GLProcessEntryDetail.CADAmount = 0