디비관련 질문입니다.

Vadis의 이미지

비록 MS-SQL이지만, 당체 해결 방법이 보이지 않아서 자문을 구하고자 합니다.

제가 엑셀을 잘 못하는 관계로 디비에서 해결을 해야 되는 상황인데요. 문제는

아래의 A 애트리뷰트를 B처럼 만들고 싶습니다. 첫번째 문자열을 만나면 그 아

래에 문자열을 만날 때까지 첫번째 문자열을 넣고, 그 다음 문자열을 변수에 담

아서 다음 문자열을 만날 때까지 넣는 간단한 프로그램인데, 구문이 어떻게 돌아

가야하는지는 알겠는데, 막상 프로그램밍을 할려니, 않되네요.

   A               B
-----         ------
안녕             안녕     |
null              안녕     |
null              안녕     |
하세요          하세요  |
null              하세요  |
null              하세요  |
그럼             그럼     |
null              그럼     |
null              그럼     |
---------------------

@i = idx증가값, @dis = 컬럼값을 담을 변수
declare @dis varchar(255), @total varchar(255), @i int
set @i = 5

declare tablecursor cursor for
select f1 from 작업 where A is not null
open tablecursor
fetch next from tablecursor into @dis
while @@fetch_status = 0
begin
{
  while @i
begin
        IF len(select f1 from f1 where idx = @i) = 0    
begin
     UPDATE table 작업
         SET A= @dis
end
end
}
print @dis
fetch next from tablecursor into @dis
end
close tablecursor

deallocate tablecursor

-------------------------------------------------------------

대충 MS-SQL에 있는 커서라는 기능을 사용해서 만들어보기는 했는데,

그 다음부터 어떻게 해야될지 모르겠네요....

시간만 여유가 있으면, 혼자서 해결해 보겠지만, 오늘 안까지는 해결해야되는

문제라서 이렇게 도움을 요청합니다. 꼭 부탁드립니다....이만...초생이...

codebank의 이미지

먼저 Vadis님이 올리신글에 대해서 문의 없이 수정하였음을 죄송스럽게 생각합니다.
(자료구분을 하기 위해서 제가 임의로 수정을 봤습니다. 죄송합니다.)
설치 및 활용 부분보다는 프로그램쪽이 맞을것 같아서 게시물을 옮기겠습니다.
(MS-SQL을 조금 만져보긴 했지만... 내부함수를 만들어서 돌려본 적이 없어서...
:oops: )

------------------------------
좋은 하루 되세요.

Vadis의 이미지

죄송합니다. 어설픈 변명이지만, 지금 회사 에어콘이 고장이나서, 정신이 몽롱

한 상태로 몇 일동안 일을 하다보니, 맛이 살짝 간듯 합니다.

한 동안 네트워크 쪽만 공부하다보니, 프로그램 쪽에서 일을 하기에는 많이 힘

드네요. 설마 디비 쪽으로 일하리라는 생각은 전혀 못했다보니, 거의 기본 실력

만 가지고 일을 하고 있습니다. 지금은 정말 하루가 26시간이였으면 좋겠습니다.^^

좋은 날 즐거운 날....

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.