Finding Code That Will Automatically Grab 3 Digits Before Dash?

Jan 6, 2014

I have the following table with two columns:

SEQ_NUM STATUS_CODE
101 D12
102 DWI - REGULAR DWW - EXPIRED
103 WRW - REG WRT - FUTURE

I would like to output the following:

SEQ_NUM STATUS_CODE
101 D12
102 DWI
102 DWW
103 WRW
103 WRT

The Status code column in the source table will have a single 3 DIGIT alphanumeric code, and sometimes a longer string. I need a code that will automatically grab the 3 digit code before the dash.

View 8 Replies


ADVERTISEMENT

Finding Last Day Date Code

Aug 1, 2014

I wanted to determine the date of the last Saturday with respect to the current date so that I could create a temp table with date ranges numbered 1-4 e.g. up to that date, post link below: URL....I now want to make this function that any time I pass it a day name (mon-sun) it will calculate the date of the previous (mon-sun) with respect to the current day. This date will then be the last date in my range.

So for example I run the function and pass it 'Friday' then I want last date in my range to be the 25th of July (today being Friday so need last Friday), I pass it Thursday I want it to give me the 31st of July etc. I need last date of that date but if I call Friday and today is Friday then need last friday; I think this is the trickier part of it.

This calculation I would image would need to use a combination of datediff dateadd etc. but really don't know how to do this dynamically.Currently I have a function that I pass the last date for the date range I want for my weeks range, I also give it the numbere of weeks I want in my range and also pass the date from the query that I want to know what week range it is in.

ALTER FUNCTION [dbo].[daterangeweeknumber]
(
-- Add the parameters for the function here
@refDate datetime,
@Weeks INT,
@lastdate datetime

]code]....

But now I want just to be able to pass it the day name - in this instance would be 'Wednesday' and want it to return date ranges with last date as Wed the 30th of July. Reason I want to use day name is that people will be running these reports on a certain day - for instance on Wednesday and last day to be Monday - and this will mean they do not have to keep changing the date in the call to function.

View 2 Replies View Related

Finding Products Code With A Table

May 29, 2008

Hi i've to table where i have a product code and a area code.

I want to insert the values from table 1 into table 2 if the product code and area code do not already exists in the table in table 2.

Am using this code below but it does not seem to be working.

select distinct p_code1, area_code
from table1
where not exists
(select p_code, area_code
from table 2 )

View 2 Replies View Related

Finding Locally Installed SQL Server 2005 Instances Via C# Code.

Apr 30, 2008



Hello,

I have found code on how to find sql server instances on your local network but my question is. Is there an easy way to find a local copy of SQL Server 2005 and what the name of the instance is. Beacuse the program I am writing will need a sql server installed somewhere on the network then it will allow the user to select either the local copy or a network copy of the sql server

example

on my computer I have SQL Server 2005 express installed and mine is Daniel-LaptopSQLEXPRESS

View 1 Replies View Related

Finding SQL 2005 Standard Edition Code Which Will Break In Express

Feb 11, 2008

Hi,

We're currently developing an application against SQL Server 2005 Standard Edition. Recently, we've started to consider deploying certain installations against SQL Server Express. We're particularly worried about some stored procedures we've written taking advantages of features which will not be available in SQL Server Express, is there a simple compliance tool or such that we can scan our existing tables/functions/stored procedures/etc with to identify potential pitfalls when running on SQL Server Express?

Thanks,
Jeremy

View 4 Replies View Related

Dash In Database Name

Mar 21, 2001

Have couple dbs with dash ( - ) in db name. Works fine. However, when I try to do operations with them in SQL Query analyzer, I keep getting errors, e.g.,

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.

What's up?

Thanks,
Yves

View 3 Replies View Related

Instance Name Contains A Dash

Jun 1, 2006

Hello

We are in the process of upgrading our SQL 2K server to a cluster environment. Currently the server is setup as a default instance running on a single box with log shipping as a warm backup

It is required to create an instance name for the new cluster to work. My question is

1) Has anybody tried to have an instance name that dash (-) in it.

Example: \SERVERNAMExxx-xx-xxx

I am told that it is not possible to have a server instance named this way. Would like to know if this naming convention is possible under SQL2K If not what is the suggested workaround

This will save a lot of time in application modifications

Thanks in advance

Gabe J

View 9 Replies View Related

How To Return Character(s) After A Dash (-)

Mar 24, 2015

I want to return the character(s) in a string directly after a dash (-) character. For example in the following numbers 72187-1 & 72187-2 I am interested in returning 1 & 2 respectively.

It is possible in my scenario that the number after the dash is two digits long, e.g.: 72187-12 in which case I want to return 12.

View 7 Replies View Related

Want To Return Character After A Dash

Mar 23, 2015

I want to return the character(s) in a string directly after a dash (-) character. For example in the following numbers 72187-1 & 72187-2 I am interested in returning 1 & 2 respectively.It is possible in my scenario that the number after the dash is two digits long, e.g.: 72187-12 in which case I want to return 12.

View 6 Replies View Related

Dash Boards With Reporting Services

Dec 18, 2006

Hi All,

I have been working on Reporting Services for quite some time but not able to find a way to create dash boards.

I hereby request you to tell me a way to do that.

An early reply from you help solve my problem.



Thanks

SPC

View 2 Replies View Related

Outputting Results - Removing Dash From Zip Codes

Sep 10, 2013

I'm trying to construct a query that takes results from a table (zip codes, essentially) and strips out the results so that it's just the first 4 digits (rather than the first 4 digits + '-.....'). Which function would allow me to do this in management studio?

View 3 Replies View Related

Transact SQL :: Replace Special Characters And Space Except Dash

Sep 18, 2015

I want to replace special characters and space except '-' Tried with Pathindex and function but not getting expected results.

Ex: Input kjkdjfdf-234#kei$ ewiw

output: kjkdjfdf-234keiewiw

View 6 Replies View Related

Grab Last Word

Sep 2, 2013

how can i only grab the last 4 ID:

data
19Jul hello ID UKAU
9Jul hello ID UJKO
7Jul hello ID POJP

View 2 Replies View Related

How To Grab In Between Data

Mar 25, 2014

I have a list of data sample as below:

MYDATA
2/26/2014 19:35:0 2/26/2014 19:35:0 2/26/2014 22:25:0 UK AUS start end
3/1/2014 9:20:0 3/1/2014 9:20:0 3/1/2014 10:5:0 AUS UK start end

How can I only grab as below:

newColumn
UK AUS
AUS UK

View 8 Replies View Related

Is It Possible To Grab Data From 2 Different Databases

Jan 28, 2004

Hello-

I have a chart I am producing in .net and I need to values. The problem is the values (sums) i need are on 2 different servers. Is there any where to combine the query using two databases? Does anyone have any suggestions?


thanks

View 5 Replies View Related

How To Grab User Name Into The Table

Aug 21, 2001

I want to include the name of the user whom so ever has changed the record.
I want to insert the name of the user in the column.
How to grab the name of the user from the action...?

Thanks,
Harish

View 1 Replies View Related

Table Name Changes - How To Grab Last 24 Hours

May 30, 2014

My DB saves it's data into a table at the end of each day like:

'e4_event_20140530' where the last bit changes according to the date. So 30th May 2014 in this case.

What I am trying to do is query the last 24 hours. I know i can grab from 2 tables and do a 'between' with times but it means having to change table name and times in the query every time i run it. I'd just like to run it and for it to just fetch the last 24 hours at any point in time.

My DB outputs time like '2014-05-30 08:54:23'

View 2 Replies View Related

How To Grab Specific Data

Aug 4, 2014

<Hello currency 988 v=""/><hello::Value v="0"/><Arrival Code v="ABC"/>
<Hello currency 988 v=""/><hello::Value v="0"/><Arrival Code v="KJHKH"/>
<Hello currency 988 v=""/><hello::Value v="0"/><Arrival Code v="POJ"/>
<Hello currency 988 v=""/><hello::Value v="0"/><Arrival Code v="AKJFISM"/>
<Hello currency 988 v=""/><hello::Value v="0"/><Arrival Code v="PM"/>

how can i only grab the arrival code?

newColumnArrivalCode
ABC
KJHKH
POJ
AKJFISM
'
'
'
'

View 4 Replies View Related

VB Programaticlly Grab Data From A DB Noob

Mar 6, 2008

  Hi, I am very new to the .net framework, but I have a lot of experince in php/mysql applications. So this is this is proboly going to seem like a nwebie question.
I am trying to pull a single item out of the database programaticlly, take the value of that item and set it to a varible so I can work with it in other areas.
Here is basically what I have this is on the vb page in a sub I have the varible MonthlyPrice Defined earlier in the pageDim connString As String = _ConfigurationManager.ConnectionStrings("ConnectioString").ConnectionString'Create a SqlConnection instanceUsing myConnection As New SqlConnection(connString)'Specify the SQL queryConst sql As String = "SELECT Price FROM Plans Where PlainID='" & PlanId & "'"'Create a SqlCommand instanceDim myCommand As New SqlCommand(sql, myConnection)'Get back a DataSetDim myDataSet As New DataSet'Create a SqlDataAdapter instanceDim ReadData As New SqlDataReader(myCommand) 'Bind the DataSet to the GridViewMonthlyPrice = ReadData("Price")'Close the connectionmyConnection.Close()End Using
I just want to get the price of the plan where planID is equal to the value of my varible planID. I want to set that equal to MonthlyPrice which is a decimal so I can add it into some calculations and return a value. I don't really want to bind the data to anything but everytime I search google I can't find anything excpet for binding data to grideview and things like that.
I have tried several diffrent approaches that I have found out there but have gotten errors or and things I am not understanding.
I originally was trying to access a datasource I already have defined that is on the aspx page.<asp:SqlDataSource ID="SQLSelectPlan" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Plans] WHERE ([PlanID] = @PlanID2)">
<SelectParameters>
<asp:FormParameter FormField="grSelectPlan" Name="PlanID2" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 Is there a way for me to grab this datasource which works and is tied to a detailed view, take the value in the price collom and stick it in the MonthlyPrice varible on my vb page? That is the approach that seems the most logical to me.
If someone has better way I would really like to know.
 
Thanks

View 12 Replies View Related

Inserting New Row, Need To Grab Key From Another Table Thats Just Inserted

Oct 11, 2004

i have 2 tables right now, po and notes...

the notes table contain the note_id and notetext, so example of a row would be:
1 this is the note for the first row
2 this is the note for computer parts

etc..

the po table has item info, description, po_id, and note_id, heres an example:

po_id item desc note_id
1 215-33 computer parts 2

the problem is, is there a way where say i insert the note row into the notes table first and then get the note_id of that, so that i can then insert the row into the po table which includes the note_id from the notes table?

would i have to use two separate inserts or can i use one? i was going to just insert the notes row first, and then use a query using the LIKE() function on the note text to get the note_id, but some notes may be the same as others, so the note_id wouldn't be the correct one :( and i think just getting the last row of the notes table would be bad too incase someone happens to insert a row into that table at the same time

any ideas please?

thanks!

View 1 Replies View Related

How Can I Grab A Notification Email Address From A Job?

Dec 9, 2004

Is there a handy-dandy way for me to be able, from a stored procedure, to capture the notification email address for a user associated with a job?

I need to send an email out from a stored procedure, and I want it to be set up to send to the same user that is set up in the job that calls the stored procedure.

the same notification stored proc will be used in multiple jobs, but the jobs are already set up with a notification email to be sent to the defined users "on completion" (error or not). I want a separate email to be sent, but I want to use xp_Sendmail because I have to perform a select who's output I want to appear in the body of the email (and unless I am missing something, I have no control over the body of the standard "job completion" email).

I would prefer to NOT have to "hard code" the user email address in the stored proc that calls xp_sendmail, OR to put it in some user table in the database, when the user I want to send it to will always be the same one defined in at the JOB level in Enterprise Manager.

Any thoughts? Thanks in advance for your instantaneous and informative answer-packed responses! ;)

View 2 Replies View Related

Grab Output Of Dynamic Sql And Use As Variable

May 5, 2008

hello,

I'd like to know how I can grab the output of the following code and use it as variable:

declare @sql nvarchar(25)
set @sql = 'SELECT CURRENT_TIMESTAMP'
EXEC(@sql)

Thank you.

View 2 Replies View Related

Create Another Column To Grab In Between Data

Apr 28, 2014

ColumnA
<Dcc::Applicable v="False"/><Dcc::DccData v="0"/><DESC v="DataReceived- 8769 datas, 9.20USD cash"/>
<Dcc::Applicable v="False"/><Dcc::DccData v="0"/><DESC v="DataReceived- 1000 datas, 14.40USD cash"/>

I have a list of data as above.How can i create another new column just to grab the data?

NewColumn
8769
1000

View 5 Replies View Related

Want To Grab A List Of Available Databases On A Given Server

Jul 23, 2005

I have MSDE running on my system and I want to get a list of databasesfor that server programmatically. I'm using vb.net and I want to view,add, delete and modify databases on a server from within a class.I'm aware I can use the "Server Explorer" feature in Visual Studio, butthat isn't what I'm looking for. Any references or suggestions on whereto start are appreciated.TIARalf

View 7 Replies View Related

String Parsing - Grab Some Key Value Pairs From Text In Column

Jul 21, 2014

I want to grab some key value pairs from the text in sql column

e.g.

some text[Key1=Val1]some text[Key2=Val2][Key3=Val3]some text

I want a function which takes Keyname as input & returns the value related with it if found.

GetValueFmKey('Key1') should return Val1 and like on.

View 1 Replies View Related

SQL Select Statement (Textbox Used To Grab Data From Database)

Sep 21, 2007

I have a problem....SOMEONE PLEASE HELP!


Here is the setup.
Text Box: User enters in customer transaction number
Button: User clicks button to display information about the customer

Now the database has a lot of unique customer numbers. What I am trying to do is take what the user enters so it can search the database and pull out that customers information. I am having a hard time getting that information from the textbox. Any suggestions! Here is what I have so far.



Private Sub btnViewFlow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewFlow.Click

Try



Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection

Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter

Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand

Me.DataSet11 = New links.DataSet1

CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit()

'

'SqlConnection1

'

Me.SqlConnection1.ConnectionString = "workstation id=<14852>;packet size=4096;user id=<userID>;password=<Strong Password>;data source=ZRTPD0WB;p" & _

"ersist security info=False;initial catalog=DTR"

'

'SqlDataAdapter1

'

Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1

Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "DTR_Document_Summary", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("DocumentId", "DocumentId"), New System.Data.Common.DataColumnMapping("PartnerId", "PartnerId"), New System.Data.Common.DataColumnMapping("PartnerName", "PartnerName"), New System.Data.Common.DataColumnMapping("Direction", "Direction"), New System.Data.Common.DataColumnMapping("TranSet", "TranSet")})})

'

'SqlSelectCommand1

'

Me.SqlSelectCommand1.CommandText = "SELECT DocumentId, PartnerId, PartnerName, Direction, TranSet FROM DTR_Document_S" & _

"ummary "

'WHERE (DTR_Document_Summary.PartnerId = 'txtPartnerId.text.toString')"
'THE STATEMENT ABOVE DOESNT WORK

Me.SqlSelectCommand1.Connection = Me.SqlConnection1

'

'DataSet11

'

Me.DataSet11.DataSetName = "DataSet1"

Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-US")

CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit()



'Open the connection

SqlConnection1.Open()

TextBox1.Text = "Connection Open"




'Populate DataSet11

SqlDataAdapter1.Fill(DataSet11)

TextBox1.Text = "DataSet11 has been filled!"


'Display Data

DataGrid1.DataBind()

TextBox1.Text = "Here is your requested information"



Catch ex As Exception

TextBox1.Text = ex.Message


End Try
'Close the connection

SqlConnection1.Close()


End Sub

View 6 Replies View Related

How Do You Grab Keys From Dimensions And Store Them Back Into Your Table

Nov 16, 2006

I have run into an issue that seems very simple but I am new to SSIS and DBs in general and therefore cannot solve it. I would like to take data from a SQL Server table, lookup a key from a dimension table and update the same SQL Server table with this data. Is there anyway to do an update using SSIS?

Thanks,

Curtis

View 1 Replies View Related

Reg Exp For Digits

Sep 18, 2005

Hi,This is not SQL Server database problem, however, net search has failedto generate a solution to the problem, I'm trying my luck at this NGnow.Problem, remove the special character, [ from text.e.g. text ="this is [1] and [stuff] and some [2] and hat [3] and dog"Desired result ="this is 1 and [stuff] and some 2 and hat 3 and dog"I know [[:digit:]] would find all the instances of digits insidebrackets such as [1], [2], [3]. However, I don't know how to get ridof the special characters of [ and ].Any regular expression expert out there?Thanks.Don

View 8 Replies View Related

How Do I Grab A Simple List Of SQL Server Views, Tables Or Sprocs?

Jul 20, 2005

I need just the names of tables, views and sprocs within a SQL Serverdatabase. What's the easiest way to do this?

View 3 Replies View Related

I Need 2 Decimal Digits

Apr 14, 2008

Hello All,

Current Format :-
40.349.462.875.589.2100112127


Required Format
40.3049.4062.8075.5089.20100.00112.00127.00


Currently mine above row data type is float. i need two points after precisions.

Thanks

View 3 Replies View Related

Right 10 Digits From Column

Oct 7, 2014

Following function in not giving me correct output:

update dbo.raw
set PhnNumber = RIGHT(calling_pty,10)

What I want is....if in case column "calling_pty" i have values like 911111111111 so it should give me the output in column "PhnNumber" as 1111111111 means only right 10

View 3 Replies View Related

Smallmoney With 2 Digits

Jan 2, 2008

I have a table for products and the price field is smallmoney data type. When I view the data stored it shows it with millionths. How do I get it to store only hundredths?

View 2 Replies View Related

Add Digits To The Front

Jul 20, 2005

Hi all,I have a number like so 778625 and want to make this a more meaningfuldate (UK) so how difficult is it to add two digits in this case 19 tothe front of this number?Many thanksSam*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 3 Replies View Related







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