Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. 747576

    dynamically split a numeric range using T-SQL

    Hi, The sql below creates a temporary table that populates numeric ranges, basically I can define a numeric range i.e. 0 to 200 and the number of splits i.e. 4, the query then splits the range into 4 intervals. The split column is my split id, so I know which is the 1st, 2nd, 3rd interval and...
  2. 747576

    Conversion failed when converting varchar to data type int

    Thanks for the advice, If I declare @compositeby as Decimal(10,1) then if set compositeby = 2 I get the wrong results. The results I get are: 1a 0.1 2 4.8 1a 2 4 4.2 1a 4 5.5 3.5 1a 6 5.5 NULL it should be: 1a 0.1 2 4.8 1a 2 4 4.2 1a 4 5.5 3.5 If the increment and compositeby are the same...
  3. 747576

    Conversion failed when converting varchar to data type int

    Hi, I have a piece of sql that composites data to a specified interval (@compositeby). If I want to composite the data in the table by a float value (not an integer) then I get an error. In the code below the @compositeby is set as 2.5, but it gives me an error: Msg 245, Level 16, State 1...
  4. 747576

    Dynamic sql - Pivot

    Hi, I am using SQL Server 2005, I would like to know the best way to dynamically pivot data from a table using a table valued function. In the code below I have an ID, TYPE, SerialNumber and SEQ column, I would like to pivot the data to give the following example: ID 4145_1 4143_1...
  5. 747576

    Dynamic sql

    Hi, I have a normalised table called RESULTS, which contains water values. I would like to pivot the values so there is a column for each type. I am able to do this with sql below and the result is: ID Water_1 Water_2 Water_3 1A 0.01 0.01 0.01 1A 0.013...
  6. 747576

    sql to combine data from a table

    Hi, I would like to know how to amalgamate interval data using t-sql. The code below creates a temp table and I would like a query to amalgamate the intervals grouping by the field CODE, I can use the sql select id,min(INVFROM),max(INVto),code from #temptable group by id,code but this...
  7. 747576

    vbscript to copy files using array

    Ok, this gives me a type mismach error. Dim FilesToCopy Dim sCopy() Dim i FilesToCopy = "file1.csv,file2.csv,file3.csv" bPath = "C:\Temp\Test2\" 'DESTINATION PATH aDate = CDate("01-JAN-2010") 'FILES CREATED AFTER THIS DATE...
  8. 747576

    vbscript to copy files using array

    Hi, How should the variables be declared: Should it be this: Dim FilesToCopy Dim sCopy() Dim i Integer
  9. 747576

    vbscript to copy files using array

    Hi,Thanks I tried the change and get the same error. I'm running the vbs from the command prompt. The files to copy are stored in the array and passed through the loop to then be copied to the destination path 'bpath', where should I set the source path. I tried the script below as well, but...
  10. 747576

    vbscript to copy files using array

    Hi, I want to copy files from an array to a destination folder, I also want to check the date as well. I tried the following script and get an error: Expected end of statement Dim FilesToCopy As String Dim sCopy() As String Dim i As Integer FilesToCopy =...
  11. 747576

    Subtract from alphanumeric string value

    mistake in message, should be - "if ID = '4235_20d' the query currently produces the prev ID as '4235_10d' when it should be '4235_19d'.
  12. 747576

    Subtract from alphanumeric string value

    I would like some help with the following query. The sql is designed to subtract 1 from the aplhanumeric value in the column ID and show the result in column [PREV_ID] The combination of numeric and non-numeric characters can vary. For example the prefix can vary like: BD001 or 1234/01c...
  13. 747576

    Sql syntax to insert into a sequece of row id's

    Hi there, The code below creates a table of data called ORIGTABLE, this table has a id column called ORIGID, that increments by 1, for example 'ID1_001','ID1_002 and so on. I have another table called TESTTABLE, which contains an id column called TESTID. The idea is that the user selects a...
  14. 747576

    Windows Batch script and SQL

    Hi, Is it possible to have sql return a comma separated list (string) of file names that exist in a folder. This can be done using a batch command script or VBScript, it will be return the file names in a specified folder, but how do I incorporate this into an sql statement or sql sp. Thank you
  15. 747576

    DATETIME

    Hi there, I am getting the following error when casting the date '24/08/2007 10:40:00' in the sql below: select cast('07/04/2009 14:57:00' as DATETIME) ok select cast('24/08/2007 10:40:00' as DATETIME) The conversion of a char data type to a datetime data type resulted in an out-of-range...
  16. 747576

    Composite sql

    Hi, This relates to thread thread183-1496513 which I am revisiting and need some more help with sql: In the following code example I have a table of TEST id's that I want to composite into 3, so 1 composite is a combination of 3 test id's, this works fine. When I add the TYPE column to the...
  17. 747576

    sql, incrementing numbers

    Hi, Is there a mathematical function or code in sql that will work out if a value is a multiple of 3. In my database a value entered into a column in my table can only increment by 3, so 3, 6, 9, 12.... is ok, 1,2,4,5,7....not ok is there way of checking a value using a function. Thank you
  18. 747576

    pass varialble to table function insert

    Hi, This question relates to question: thread183-1545958 I have a dynamis sql statement that returns a view of results. I'd like to use the same statement in a table function, which I can pass the variable @type into. When I constructed the function I recieved the error : "An INSERT statement...
  19. 747576

    dynamic sql

    Hi, I was able to build a dynamic sql script to query the data, I am passing the variable @type. This is fine, but is it possible to use the script in a table function, I tried it and recieved the following error: "An INSERT statement cannot contain a SELECT statement that assigns values to a...
  20. 747576

    dynamic sql

    Hi, I am using sql 2005. I would like some help with select data from 3 normalised tables, but dynamically. I have 3 tables HEADER, RESULT and TYPE. The TYPE table is like a reference table for the NAME field in RESULT. I want to select the results from the HEADER and RESULT tables but pivot...

Part and Inventory Search

Back
Top