Convert Question Revisited

Nov 20, 2000

hi,

I guess my brain isn't functioning on monday morning. I am trying to do a convert with little success.

what I want to do is insert a character string into a smallint column of a table. i.e.

DECLARE @a char(6)
select @a = 'string'




I have tried the following and variations on it, but get a syntax error

insert table testtable (1,convert(smallint,@a))

The columns in testtable are both smallint datatypes.


Thanks in advance



-- I got this response, but seem to get a convert error even
when using the below example


Try this :

DECLARE @a char(6),
@b smallint
select @a = 'string'
select @b = convert(smallint, @a)

insert testtable values (1, @b)


any suggestions?

View 2 Replies


ADVERTISEMENT

RDLC Vs RDL Revisited

May 8, 2007

I have searched the archive of this forum, and based on some previous answers have read the followin FAQ



http://www.gotreportviewer.com/



However, even so, I still have a questoin about when to use RDLC vs RDL from the point of view of licensing and load sharing betwee DB and report server.



1. As we all know that SSRS will take a license of SQL Server if the web service is deployed on any other machine other than SQL Server (which is normally the case because no serious DBA will allow IIS apps to be installed on the DB Server). Also, if the SSRS is deployed on NLB cluster then each node of the cluster would need a "SQL Enterprise" license. (which can be very expensive).

2. Co deploying the SSRS with SQL Server is a bad idea because it puts excessive load on the DB+Report Server.

3. Since there is no "load balancing" in SQL all the rendering has to be done by the SSRS service which is running on the DB Server.



Now compare this to RDLC



1. RDLC gives me the same engine as RDL

2. However it has no licensing tags to it.

3. I can deploy ASP.NET report viewer on my web farm and scale it out as much as I like.

4. Extract data from the DB using stored procedures.



So it seems that RDLC solution is cheaper, gives better scale out capabilities and also moves the rendering of reports on the web farm rather than the Report Server.



Why should me or anyone else choose RDL at all?



There seems to be one disadvantage that the data has to fetched programmatically and manually binded (like an ASP.NET app) as RDLC does not provide any feature to connect to data sources. But this is not much when you see the cost and scalability benefits.



regards,

Abhishek.

View 6 Replies View Related

SQL Server Question Revisited-What Is The Best Way??

Mar 16, 2004

I am new to this but here goes.
I have a sqlserver with asp.net.I have a stored procedure in the database
named Try_Login .I need to know how and what is the best way to accomplish my task.I need the data in the stored procedure after it runs.Do I use the ExecuteReader() Method or how do I go about retrieving these values?????

CREATE procedure dbo.Try_Login
(
@LoginName nvarchar(15),
@Password NvarChar(15)
)
as
select
UserName,
UserPassword,
UserClinic,
UserTester
from
Clinic_users
where
UserName = @LoginName
and
UserPassword = @Password

What I need to know is how to get my code to correspond with it.I.E. I have a login in form...
txtUsername and txtPassword need to be passed to this Stored procedure.
I assume you use .value to obtain thier values.Here is my code so far......

Public Sub LoginDB()
Dim conLogin As SqlConnection
Dim cmdLogin As SqlCommand
Dim dtrLogin As SqlDataReader
conLogin = New SqlConnection ("Server=myserver;database=APPOINTMENTS;uid=XXXX;pwd=XXXX")
cmdLogin = New SqlCommand("Try_Login ", conLogin)
cmdLogin.CommandType = CommandType.StoredProcedure
cmdLogin.Parameters.Add("@LoginName",txtUsername.Text)
cmdLogin.Parameters.Add("@Password",txtPassword.Text)

dtrLogin = cmdLogin.ExecuteReader()

While dtrLogin.Read()

End While
End Sub

I have no clue why it does not work..........

View 1 Replies View Related

Basic Query Help - Revisited

Jul 14, 2001

I'm not getting it. The query below "e.g." is exactly as I think it should be except for the <Join Clause> as there is only the match on site name. I tried joing on the site name, but only got the sites in the log. I want all the site names even if they don't have a log item for a given date range.

I'd post my real query if it would help, it's just that I'm chopping up some strings and converting some time stamps to dates as varchar for readability for the final report, which is an MSExcel pivot table.

My original post lies below.

TIA

jEfFp...

Reply...
Date: Basic Query Help (reply)
RickD (Rick.Davis@Schroders.com)
7/11/01 6:41:26 AM

Make log an outer join to site.

e.g

select s.name, l.ondate from
site s
RIGHT OUTER JOIN log l ON <Join Clause> where
substring(id,3,6) in(select name from site)
and ondate between getdate()-8 and getdate()-1

You didn't seem to have any logical join between the tables, but i'm sure you have, just put this in the <Join Clause>.

Oh, and read BoL, it helps no end.....

------------
Original Post...
Jeff Proctor at 7/10/01 11:18:31 PM

my 7 day query....

select s.name, l.ondate from
site s, log l where
substring(id,3,6) in(select name from site)
and ondate between getdate()-8 and getdate()-1

This returns those sites that exist in the current log, however what I want is a result set that has a row for each name regardless if they are in the log.

I have 2 tables...

table1 sites
name
smithj
anandt
burtot
proctj
etc....

table2 log
id ondate
02anandt 07/01/01
02anandt 07/03/01
02anandt 07/03/01
01smithj 07/03/01
03burtot 07/05/01
01smithj 07/05/01
03burtot 07/05/01
etc.....

View 1 Replies View Related

Error 18452 Revisited

Feb 16, 2000

I keep getting this error when tring to log in to a SQL 7 db from a client application written in VB6.

The text reads:

Login failed for user 'rmuser'. Reason: Not associated with a trusted SQL Server connection.

I have the account setup in SQL security and I have the account listed in the database and I'm using named pipes on a common domain. I'm running out of options. The network is a mix of Novell and NT. Please help

View 1 Replies View Related

Monster Select Statement Revisited

Mar 11, 2007

I have a database with a date of birth.  From this, I need to select records that include a large number of variables including records where an individual is older than a selected age and/or younger than a selected age, and even worse, of a given astrological sign if one is selected.  I'm currently using a strongly typed dataset.  Is this something that's do-able with a dataset, or should I build the select string on the form programmatically?   I have an ASP site that I'm re-writing in ASP.NET 2.0.  In the ASP site the select string includes the code below.  I just don't see how  I can do this in a dataset.if (strLowerAge <> 18) or (strUpperAge <> 99) then      If (strLowerAge <> "") Then         strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DateDiff(yyyy, [DATE OF BIRTH], '" & date & "') >= " & strLowerAge & ")"      End If      If (strUpperAge <> "") Then         If (strSQL <> "") Then            strSQL = strSQL & " AND (DateDiff(yyyy, [DATE OF BIRTH], '" & date & "') <= " & strUpperAge & ")"         Else            strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DateDiff(yyyy, [DATE OF BIRTH], '" & date & "') <= " & strUpperAge & ")"         End If      end if   End If   If (strAstSign <> "") Then      Select Case strAstSign          Case "Aries 3/21 - 4/19"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 3 AND DATEPART(d,[DATE OF BIRTH]) > 20 ) OR (DATEPART(m,[DATE OF BIRTH]) = 4 AND DATEPART(d,[DATE OF BIRTH]) < 20 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m, [DATE OF BIRTH]) = 3 AND DATEPART(d, [DATE OF BIRTH]) > 20 ) OR (DATEPART(m, [DATE OF BIRTH]) = 4 AND DATEPART(d, [DATE OF BIRTH]) < 20 )"            End If         Case "Taurus 4/20 - 5/20"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 4 AND DATEPART(d,[DATE OF BIRTH]) > 19 ) OR (DATEPART(m,[DATE OF BIRTH]) = 5 AND DATEPART(d,[DATE OF BIRTH]) < 21 ))"           Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 4 AND DATEPART(d,[DATE OF BIRTH]) > 19 ) OR (DATEPART(m,[DATE OF BIRTH]) = 5 AND DATEPART(d,[DATE OF BIRTH]) < 21 )"            End If         Case "Gemini 5/21 - 6/20"            If (strSQL <> "") Then              strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 5 AND DATEPART(d,[DATE OF BIRTH]) > 20 ) OR (DATEPART(m,[DATE OF BIRTH]) = 6 AND DATEPART(d,[DATE OF BIRTH]) < 21 ))"           Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 5 AND DATEPART(d,[DATE OF BIRTH]) > 20 ) OR (DATEPART(m,[DATE OF BIRTH]) = 6 AND DATEPART(d,[DATE OF BIRTH]) < 21 )"            End If         Case "Cancer 6/21 - 7/22"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 6 AND DATEPART(d,[DATE OF BIRTH]) > 20 ) OR (DATEPART(m,[DATE OF BIRTH]) = 7 AND DATEPART(d,[DATE OF BIRTH]) < 23 ))"           Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 6 AND DATEPART(d,[DATE OF BIRTH]) > 20 ) OR (DATEPART(m,[DATE OF BIRTH]) = 7 AND DATEPART(d,[DATE OF BIRTH]) < 23 )"            End If            Case "Leo 7/23 - 8/22"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 7 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 8 AND DATEPART(d,[DATE OF BIRTH]) < 23 ))"           Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 7 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 8 AND DATEPART(d,[DATE OF BIRTH]) < 23 )"            End If         Case "Virgo 8/23 - 9/22"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 8 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 9 AND DATEPART(d,[DATE OF BIRTH]) < 23 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 8 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 9 AND DATEPART(d,[DATE OF BIRTH]) < 23 )"            End If         Case "Libra 9/23 - 10/22"            If (strSQL <> "") Then              strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 9 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 10 AND DATEPART(d,[DATE OF BIRTH]) < 23 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 9 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 10 AND DATEPART(d,[DATE OF BIRTH]) < 23 )"            End If         Case "Scorpio 10/23 - 11/21"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 10 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 11 AND DATEPART(d,[DATE OF BIRTH]) < 22 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 10 AND DATEPART(d,[DATE OF BIRTH]) > 22 ) OR (DATEPART(m,[DATE OF BIRTH]) = 11 AND DATEPART(d,[DATE OF BIRTH]) < 22 )"            End If         Case "Sagittarius 11/22 - 12/21"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 11 AND DATEPART(d,[DATE OF BIRTH]) > 21 ) OR (DATEPART(m,[DATE OF BIRTH]) = 12 AND DATEPART(d,[DATE OF BIRTH]) < 22 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 11 AND DATEPART(d,[DATE OF BIRTH]) > 21 ) OR (DATEPART(m,[DATE OF BIRTH]) = 12 AND DATEPART(d,[DATE OF BIRTH]) < 22 )"            End If         Case "Capricorn 12/22 - 1/19"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 12 AND DATEPART(d,[DATE OF BIRTH]) > 21 ) OR (DATEPART(m,[DATE OF BIRTH]) = 1 AND DATEPART(d,[DATE OF BIRTH]) < 20 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 12 AND DATEPART(d,[DATE OF BIRTH]) > 21 ) OR (DATEPART(m,[DATE OF BIRTH]) = 1 AND DATEPART(d,[DATE OF BIRTH]) < 20 )"            End If         Case "Aquarius 1/20 - 2/18"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 1 AND DATEPART(d,[DATE OF BIRTH]) > 19 ) OR (DATEPART(m,[DATE OF BIRTH]) = 2 AND DATEPART(d,[DATE OF BIRTH]) < 19 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 1 AND DATEPART(d,[DATE OF BIRTH]) > 19 ) OR (DATEPART(m,[DATE OF BIRTH]) = 2 AND DATEPART(d,[DATE OF BIRTH]) < 19 )"            End If         Case "Pisces 2/19 - 3/20"            If (strSQL <> "") Then               strSQL = strSQL & " AND ((DATEPART(m,[DATE OF BIRTH]) = 2 AND DATEPART(d,[DATE OF BIRTH]) > 18 ) OR (DATEPART(m,[DATE OF BIRTH]) = 3 AND DATEPART(d,[DATE OF BIRTH]) < 21 ))"            Else               strSQL = "SELECT [DATE OF BIRTH], [FIRST NAME], [LAST NAME], [STATE], [MALE OR FEMALE] FROM members WHERE (DATEPART(m,[DATE OF BIRTH]) = 2 AND DATEPART(d,[DATE OF BIRTH]) > 18 ) OR (DATEPART(m,[DATE OF BIRTH]) = 3 AND DATEPART(d,[DATE OF BIRTH]) < 21 )"            End If      End Select      END IFDiane 

View 3 Replies View Related

Passing A Parameter Into SQL OpenQuery, Revisited

Nov 10, 2003

Greetings. ASP.NET neophyte seeking a bit of advice. I am looking for the specific syntax that allows me to pass a local variable into an open query within SQL 2000 for a linked server, such as:

SELECT [ticketno] from OpenQuery(JWS_GR, 'select ticketno from tksmisc where itemno = 1 AND ticketno = @scaleticketno')

I included the variable @scaleticketno here where I was using an actual value. This doesn't work, returning the eqivalent of a database 'DUH?' message because the linked server database engine (Pervasive SQL 2000i) has no idea how to treat @scaleticketno. (Nor do I.) Any thoughts, suggestions or recommendations would be much appreciated and regarded with eternal gratitude.

View 1 Replies View Related

SSRS Audit Report Revisited

Oct 2, 2007

Building on the thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2205669&SiteID=1 which Jessica Moss posted the code below:




Code Block
select u.UserName, c.Path, r.RoleName
from ReportServer.dbo.PolicyUserRole pur
left join ReportServer.dbo.Users u on pur.userID=u.userID
left join ReportServer.dbo.Roles r on pur.roleID=r.roleID
left join ReportServer.dbo.Catalog c on pur.policyID=c.policyID
order by u.UserName, c.Path, r.RoleName





I tried to take it one step further and add a parameter where I could just type in the users Active Directory login id, thus limiting the result set. I also wanted to avoid having to type in the domainnameuserid for each parameter and only wanted to type the userid. So I changed the code (see below) and added a multi-value parameter called users.




Code Block
select u.UserName, c.Path, r.RoleName
from ReportServer$SQL2005DSS.dbo.PolicyUserRole pur
left join ReportServer$SQL2005DSS.dbo.Users u on pur.userID=u.userID
left join ReportServer$SQL2005DSS.dbo.Roles r on pur.roleID=r.roleID
left join ReportServer$SQL2005DSS.dbo.Catalog c on pur.policyID=c.policyID
where u.Username IN('DOMAINNAME' + @Users)
order by u.UserName, c.Path, r.RoleName




Unfortunately, if I type:
Domainnamejblack
Domainnamejdoe
Domainnameefranks

I only get a return for the first userid entered. Any ideas?

View 4 Replies View Related

Returning Range Of Records From SQL Server 7 - Old Issue Revisited

Oct 19, 2006

Hi all,I am using the following stored procedure in SQL 7 to return a range of records.CREATE PROCEDURE spRetMyTable@maxRows int, @lastRecord int, @SortPhrase varchar(122)ASbeginDECLARE @stSql VARCHAR(255) SET ROWCOUNT @maxRowsSET @stSql = 'SELECT * FROM (SELECT TOP 10 colPrimary, col1, col2, col3 FROM (SELECT TOP ' + CONVERT(VARCHAR, @lastRecord) +     'colPrimary, col1, col2, col3 FROM [MyTable] ORDER BY [colPrimary] ASC) AS tbl1 ORDER BY [colPrimary] DESC) AS tbl2 ORDER by [colPrimary] ASC'exec(@stSql)set rowcount 0endTo execute the above procedure I am issuing the command:execute spRetMyTable @maxRows 10, @lastRecord 1500The column [colPrimary] is the primary field in the table.I will be using the selected records in a gridView with paging (3 records per page). So if the next page is selected I would require to take out record 1491 to record 1494 and Add record 1501 to record 1503 in the datatable subject to the availability of records in the table MyTable.How do I provide sorting by col1, col2 or col3? It could be single column or multiple column sorting as chosen by the user during runtime.Is there any performance overhead in the above method in the first place?Could it be improved by any alternative process?I need YOUR ASSISTANCE to cater to the above issues in a feasible way.Thanks in advance. 

View 2 Replies View Related

SIMPLE Command To Convert String To Number? Not CAST Or CONVERT.

Aug 15, 2006

Dear Experts,Ok, I hate to ask such a seemingly dumb question, but I'vealready spent far too much time on this. More that Iwould care to admit.In Sql server, how do I simply change a character into a number??????In Oracle, it is:select to_number(20.55)from dualTO_NUMBER(20.55)----------------20.55And we are on with our lives.In sql server, using the Northwinds database:SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2)) as a_number,cast ( STR(r.regionid) as int ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2) ) as a_number,cast (STR(r.regionid,7,2) as numeric ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044Str converts from number to string in one motion.Isn't there a simple function in Sql Server to convertfrom string to number?What is the secret?Thanks

View 4 Replies View Related

Select Convert(varchar(16), Getdate(), 101)+LEFT(REPLACE(convert(varchar, Getdate(), 108), ':', ''),4)

Sep 26, 2007



select convert(varchar(16), getdate(), 101)+LEFT(REPLACE(convert(varchar, getdate(), 108), ':', ''),4)

From above query I get

mmddyyyyhhmm

but it' s yyyy and hour can not be separated

04/12/200702:05

How can I separated the year and hour ?

Thanks
Daniel

View 2 Replies View Related

Convert Mdf To Mdb

Jul 29, 2007

hi all,
I'm using visual web developer and created a project with a mdf data file. how can I convert this file to MS ACCESS mdb file?
 Thanks

View 3 Replies View Related

Convert .MDF To .bak

Oct 3, 2007

hi friends i am using vwd 2005 i created a project now i want to upload it on the server, but i want which database i used in the database convert it into .bak file for upload it on the server how i convert it, i don't have MS SQL SERVER 2005 or any except vwd 2005.

View 1 Replies View Related

Convert

Nov 1, 2007

how to convert msaccess 2003 data to sqlserver 2005

View 1 Replies View Related

How To Convert?

Jan 29, 2008

Hi all,
 
  How to convert varchar value to int in SQL Server2000?
  For example i'm having the varchar value '1,2,3,4'
  i want to convert this to 1,2,3,4 that is i want to remove single quote (') at the start and end of the varchar value,
  how to do this?
 
Thanks!

View 5 Replies View Related

Help Me Convert This.

Mar 6, 2008

 Hello! I need help to change this to @@Identity..Thanks!     protected void Button2_Click(object sender, EventArgs e)    {       
SqlConnection con = new
SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ThesisConnectionString"].ToString());        con.Open();       SqlCommand com1 = new SqlCommand();        com1.Connection = con;        com1.CommandText = "Insert into TransactionHeader values ('" +  DateTime.Now + "', '"            + DropDownList1.SelectedValue + "', '"            + TextBox1.Text + "', '"            + TextBox4.Text + "', '"            + TextBox9.Text + "', '"            + TextBox11.Text + "', '"            + TextBox12.Text + "');select scope_identity() as returnidentity";            string xyz = Convert.ToString(com1.ExecuteScalar());                               DataTable dt = (DataTable)Session["shoppingCart"];        for (int i = 0; i <= dt.Rows.Count - 1; i++)        {            String WasteType = dt.Rows[i][0].ToString();            double Volume = double.Parse(dt.Rows[i][1].ToString());            double Fees = double.Parse(dt.Rows[i][2].ToString());            double total = Volume * Fees;            SqlCommand com = new SqlCommand();            com.Connection = con;            com.CommandText = "Insert into TransactionDetail values ('" + xyz + "', '"                + WasteType + "', '"                + Volume + "', '"                + total + "')";            com.ExecuteNonQuery();            ClientScript.RegisterStartupScript(GetType(), "save", "alert('Record Saved');", true);        }                                 }  

View 2 Replies View Related

Convert() Help...

May 24, 2004

How can I convert a date to MMDDYY with Convert()?

View 3 Replies View Related

How To Convert This?

Jun 18, 2004

Hi, I am new to Sql.

My question is how to convert nvarchar like this "Wed Jun 16 19:14:23 2004 GMT" to standard datetime format?


Thanks!

View 2 Replies View Related

Convert

Nov 15, 2001

Hi,

Can anyone tell me, how can I get the date format in YYYYMMDDHHMISS format.
For Ex: select convert(char(12),getdate(),112) gives me the result as
'20011115'. Now, how can I get the the result something like '20011115110020'?

View 3 Replies View Related

Convert From Hex

May 24, 2001

If I do a query from SQL 7.0 and get the result "10" which is a hex value (0x0A), how do I convert this using something like convert or cast to show "a"
Is there anywhere that I can look for help? I can get it to show 0x0A using cast, but that is not what I want. I want a hex number without 0X0 in front of A. The A I can convert using something like Lower(A)

Thank you.

View 1 Replies View Related

Convert

Oct 11, 2001

Hi, I am trying to convert 2 columns from varchar(255) to datetime, the format of the data in the columns is '02/02/2001', and 1 column from varchar(255) to money, the format of the data in this column is '12,340.00'.

When I run : select convert(datetime, Col004), convert(datetime, Col005), convert(money, Col007) from table1

I get a result upto 59,996 rows then get the error:

Syntax error converting datetime from character string.

Any help would be appreciated, I have to convert 4 tables with, 722834, 1113978, 115489 and 121983 rows respectivly.

View 3 Replies View Related

Convert

Jun 2, 1999

Is there a way to install MS SQL 6.5 twice on the same server? I would like to install SQL into the following dorectories D:MSSQL and D:MSSQL2. Any help would be appreciated.

View 5 Replies View Related

Convert To T-SQL

Sep 24, 2004

can anybody convert this to T-SQl :

Select decode(trunc((d_vst_btcdte - nvl(n_per_birth,d_vst_btcdte))/10000,0),0,'no DOB',
14,'14-16',15,'14-16',16,'14-16',
17,'17-20',18,'17-20',19,'17-20',20,'17-20',
21,'21-25',22,'21-25',23,'21-25',24,'21-25',25,'21-25',
26,'26-30',27,'26-30',28,'26-30',29,'26-30',30,'26-30',
31,'31-35',32,'31-35',33,'31-35',34,'31-35',35,'31-35',
36,'36-40',37,'36-40',38,'36-40',39,'36-40',40,'36-40',
41,'41-45',42,'41-45',43,'41-45',44,'41-45',45,'41-45',
46,'46-50',47,'46-50',48,'46-50',49,'46-50',50,'46-50',
51,'51-55',52,'51-55',53,'51-55',54,'51-55',55,'51-55',
56,'56-60',57,'56-60',58,'56-60',59,'56-60',60,'56-60',
61,'61-65',62,'61-65',63,'61-65',64,'61-65',65,'61-65',
66,'66-70',67,'66-70',68,'66-70',69,'66-70',70,'66-70',
'71+') AGE

View 1 Replies View Related

Convert To T-SQL

Oct 12, 2004

Can anybody convert to T-SQL;
select distinct to_char(sysdate,'FMDAY, MONTH DD, YYYY HH:FMMIAM') TODAY
, d_aaa_insthdg CNTRHD
, decode(trunc((d_vst_btcdte - nvl(n_per_birth,d_vst_btcdte))/10000,0),0,'no DOB',
14,'14-16',15,'14-16',16,'14-16',
17,'17-20',18,'17-20',19,'17-20',20,'17-20',
21,'21-25',22,'21-25',23,'21-25',24,'21-25',25,'21-25',
26,'26-30',27,'26-30',28,'26-30',29,'26-30',30,'26-30',
31,'31-35',32,'31-35',33,'31-35',34,'31-35',35,'31-35',
36,'36-40',37,'36-40',38,'36-40',39,'36-40',40,'36-40',
41,'41-45',42,'41-45',43,'41-45',44,'41-45',45,'41-45',
46,'46-50',47,'46-50',48,'46-50',49,'46-50',50,'46-50',
51,'51-55',52,'51-55',53,'51-55',54,'51-55',55,'51-55',
56,'56-60',57,'56-60',58,'56-60',59,'56-60',60,'56-60',
61,'61-65',62,'61-65',63,'61-65',64,'61-65',65,'61-65',
66,'66-70',67,'66-70',68,'66-70',69,'66-70',70,'66-70',
'71+') AGE
, sum(decode(d_vst_dontyp,'WB',1,0)) DRAW1
, sum(decode(d_vst_dontyp,'xx',1,1)) TOTAL0

View 1 Replies View Related

Convert Xml To Db

Feb 20, 2008

dear all,

i have an XML that i want to create a database for it, so depending on this XML i need to create the right tables to store the information in tables and then call these info from the database instead of from XML.

it is a big XML but here is just one part, the other parts are the same:

<?xml version="1.0" encoding="UTF-8" ?>
- <RENTETARIEVEN date="04-12-2007 00:00">
- <GELDVERSTREKKER mvcode="AA" naam="ABN AMRO">
- <HYPVORM mvcode="aflosvrij">
- <PRODUCT mvcode="2000" mvproductcode="197" naam="Aflossingsvrije hypotheek" renteaangepast="4-10-2007">
- <VARIABEL>
<NHG>5.4</NHG>
<EW ew="75">5.6</EW>
<EW ew="90">5.9</EW>
<EW ew="100">5.9</EW>
<EW ew="125">5.9</EW>
</VARIABEL>
+ <VAST periode="1">
+ <VAST periode="2">
+ <VAST periode="3">
+ <VAST periode="5">
+ <VAST periode="6">
+ <VAST periode="7">
+ <VAST periode="10">
+ <VAST periode="12">
+ <VAST periode="15">
+ <VAST periode="20">
+ <VAST periode="25">
+ <VAST periode="30">
+ <PRODUCT mvcode="XX" mvproductcode="9045" naam="Internet hypotheek" overbrugging="6.6" renteaangepast="3-12-2007">
+ <HYPVORM mvcode="annuiteit">
+ <PRODUCT mvcode="1000" mvproductcode="286" naam="Annuïteitenhypotheek" renteaangepast="4-10-2007">
- <VARIABEL>
<NHG>5.4</NHG>
<EW ew="75">5.6</EW>
<EW ew="90">5.9</EW>
<EW ew="100">5.9</EW>
<EW ew="125">5.9</EW>
</VARIABEL>
- <VAST periode="1">
<NHG>5.3</NHG>
<EW ew="75">5.5</EW>
<EW ew="90">5.6</EW>
<EW ew="100">5.6</EW>
<EW ew="125">5.8</EW>
</VAST>
- <VAST periode="2">
<NHG>5.3</NHG>
<EW ew="75">5.5</EW>
<EW ew="90">5.6</EW>
<EW ew="100">5.6</EW>
<EW ew="125">5.8</EW>
</VAST>
- <VAST periode="3">
<NHG>5.3</NHG>
<EW ew="75">5.5</EW>
<EW ew="90">5.6</EW>
<EW ew="100">5.6</EW>
<EW ew="125">5.8</EW>
</VAST>
- <VAST periode="5">
<NHG>5.3</NHG>
<EW ew="75">5.5</EW>
<EW ew="90">5.6</EW>
<EW ew="100">5.6</EW>
<EW ew="125">5.8</EW>
</VAST>
- <VAST periode="6">
<NHG>5.3</NHG>
<EW ew="75">5.5</EW>
<EW ew="90">5.6</EW>
<EW ew="100">5.6</EW>
<EW ew="125">5.8</EW>
</VAST>
- <VAST periode="7">
<NHG>5.4</NHG>
<EW ew="75">5.6</EW>
<EW ew="90">5.7</EW>
<EW ew="100">5.7</EW>
<EW ew="125">5.9</EW>
</VAST>
- <VAST periode="10">
<NHG>5.4</NHG>
<EW ew="75">5.6</EW>
<EW ew="90">5.7</EW>
<EW ew="100">5.7</EW>
<EW ew="125">5.9</EW>
</VAST>
- <VAST periode="12">
<NHG>5.5</NHG>
<EW ew="75">5.7</EW>
<EW ew="90">5.8</EW>
<EW ew="100">5.8</EW>
<EW ew="125">6</EW>
</VAST>
- <VAST periode="15">
<NHG>5.6</NHG>
<EW ew="75">5.8</EW>
<EW ew="90">5.9</EW>
<EW ew="100">5.9</EW>
<EW ew="125">6.1</EW>
</VAST>
- <VAST periode="20">
<NHG>5.7</NHG>
<EW ew="75">5.9</EW>
<EW ew="90">6</EW>
<EW ew="100">6</EW>
<EW ew="125">6.2</EW>
</VAST>
- <VAST periode="25">
<NHG>5.7</NHG>
<EW ew="75">5.9</EW>
<EW ew="90">6</EW>
<EW ew="100">6</EW>
<EW ew="125">6.2</EW>
</VAST>
- <VAST periode="30">
<NHG>5.8</NHG>
<EW ew="75">6</EW>
<EW ew="90">6.1</EW>
<EW ew="100">6.1</EW>
<EW ew="125">6.3</EW>
</VAST>
</PRODUCT>
</HYPVORM>
- <HYPVORM mvcode="beleggers">
+ <PRODUCT mvcode="XX" mvproductcode="9050" naam="Internet hypotheek" overbrugging="6.6" renteaangepast="3-12-2007">
+ <VARIABEL>
+ <HYPVORM mvcode="hybride">
+ <PRODUCT mvcode="4000" mvproductcode="2316" naam="Meegroeihypotheek" renteaangepast="4-10-2007">
+ <HYPVORM mvcode="lineair">
- <PRODUCT mvcode="6000" mvproductcode="2509" naam="Lineaire hypotheek" renteaangepast="4-10-2007">
+ <VARIABEL>
+ <HYPVORM mvcode="spaar">
- <PRODUCT mvcode="7000" mvproductcode="3110" naam="Meegroeihypotheek" renteaangepast="4-10-2007">
+ <PRODUCT mvcode="7109" mvproductcode="7687" naam="Spaargroeihypotheek" renteaangepast="4-10-2007">
+ <HYPVORM mvcode="tradleven">
+ <PRODUCT mvcode="5000" mvproductcode="3214" naam="Levensverzekeringhypotheek" renteaangepast="4-10-2007">
+ <HYPVORM mvcode="unitlink">
+ <PRODUCT mvcode="8000" mvproductcode="1486" naam="Meegroeihypotheek" renteaangepast="4-10-2007">
</PRODUCT>
</HYPVORM>
</GELDVERSTREKKER>

i already started creating some tables but i need to know some good practice to o this. any help will be very appriciated


thanks

View 3 Replies View Related

Convert

Jan 15, 2004

I want to do this

SELECT TOP 100 PERCENT CONVERT(smalldatetime, DOCDATE, 105) AS DOCDATE
FROM SQSDBA.D_DETAILS
WHERE (DOCTYPE = 'SSCB') AND (DOCNUM = 155)
ORDER BY ROWNO

It is returning a date as 13/12/2003 ???

Any Ideas ?

Michael

View 13 Replies View Related

Convert

Jan 31, 2007

hi
how can i convert smallint to varchar
declare @over smallint
[rollover_txn] = CASE WHEN hh.[deint] & ' + CAST(varchar(5),@over)+ ' = ' + CAST(varchar(5),@over) + ' THEN 1 ELSE 0 END,



krmm

View 15 Replies View Related

How To Convert Value?

Feb 21, 2007

How do I convert a value in a qeuery to be displayed as money or currency?

Thanks,

www.myspace.com/drew22299

View 1 Replies View Related

Convert

Oct 30, 2007

I'm trying to convert an int to a string in my expression in ssis. Is this possible? I keep getting an error and I've also tried the cast operator, can't figure it out! Can someone help?

@[User::Path]+ "DEN" + Cast(@[User::Counter] as string)

thanks,
Mike

View 2 Replies View Related

How To Convert SDF To XML?

May 19, 2006

Hi All,

Did anyone know or can tell me how I can convert SDF to XML? and XML to SDF? Is there are tools or any code for me can use?

My boss don't want to use Merge Replication/RDA to push data from PDA to PC because sometimes got error when he want to replicate data.

View 4 Replies View Related

Convert Bug?

Apr 13, 2007

Hello, I am having trouble using CONVERT, I am using this select statement






Code Snippet

SELECT a.TaskId,a.Name,a.Description,a.StartDate,

CASE WHEN Convert(nvarchar,a.DueDate,101) = Convert(nvarchar,getdate(),101)

THEN

CONVERT(nvarchar,a.DueDate,108)

ELSE

a.DueDate

END as DueDate, a.NotificationRuleId, c.RowStateTypeId, a.CustomerId, a.CustomerIdent, a.SourceCustomerId, a.CreatedByUserId, a.CreatedDate, a.UpdatedByUserId, a.UpdatedDate, u.FirstName + ' ' + u.LastName as CreatedBy, r.Name as Status FROM Task a inner join AssignedTask c on a.TaskId = c.TaskId inner join UserAssignedTask b on c.AssignedTaskId = b.AssignedTaskId INNER JOIN [User] u on u.UserId = b.UserId INNER JOIN RowStateType r on c.RowStateTypeId = r.RowStateTypeId WHERE b.UserId = {0} and c.RowStateTypeId<>8









but if the statement hits the CONVERT section it formats the date as 1900-1-1 (time) instead of just (time) which is what I am looking for, is there any other way I can accomplish this?

View 1 Replies View Related

Convert

Dec 7, 2007

Hello,

I am making reports with SQL and Reporting Services.
To day I wanted to convert a field to datetime.
It had to have the style of Holland, so dd-mm-yyyy.
I used the following code, which not gives the expected output:




Code Block

CONVERT(DATETIME, Objectplaatsingsdatum, 105) AS Objectplaatsingsdatumconvert
It gives output like:
7/1/1992 12:00:00 AM
It is sure not what i wanted.

Can someone tell me what I do wrong?
The 105 stands for the style I wanted, so I do not know where it goes wrong.

Thanks,

View 5 Replies View Related

Convert

Nov 22, 2007

hi
below is my procedure.ToDate is varchar datatype.i can not make it datetime as per my need..so my date is now storing
in this format 11/2/2007..but i want to store this 2007-11-02 00:00:00.000 in this format ..how to do this ?

thanx


CREATE PROCEDURE sp_WriteLiveInDates
@ClientID INT,
@LiveInStatus BIT,
@FromDate DATETIME,
@ToDate VARCHAR(50) = null

AS
BEGIN
SET NOCOUNT ON
/* IF EXISTS (SELECT LiveInID FROM t_HR_LiveINDates WHERE ClientID=@ClientID AND RecordStatus = 1)
BEGIN
UPDATE
t_HR_LiveINDates
SET
FromDate = @FromDate,
ToDate = @ToDate,
DateModified = GETDATE()
WHERE
ClientID=@ClientID
IF @@error <> 0
RETURN(0)
ELSE
RETURN(1)
END
ELSE */
BEGIN
INSERT INTO t_HR_LiveINDates
(ClientID,
LiveInStatus,
FromDate,
ToDate,
RecordStatus,
DateCreated
)
VALUES
(@ClientID,
@LiveInStatus,
@FromDate,
@ToDate,
1,
GETDATE()
)

IF @@error <> 0
RETURN(0)
ELSE
RETURN(1)
END
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

View 8 Replies View Related







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